I have an iframe nav system, each nav link calls a function passing an argument, then the funtion rewrites the nav table, making the clicked link selected and all others normal and so on. It works fine, however, this script in the end should actually load the requested page into the parent of this nav frame. All i get is crap, the main page loads inside the iframe, here is the funtion:
function gotoPage(id) {
var nameArr = new Array("Home", "Articles", "Experiments", "Links", "About")
var linkArr = new Array("index.html", "HTML/articles.html", "HTML/experiments.html", "HTML/links.html", "HTML/about.html")
window.parent.location = linkArr[id]
if (document.getElementById){
x = document.getElementById(id);
//alert(x.innerHTML)
x.innerHTML = '';
x.innerHTML = '<div class="selTab">'+nameArr[id]+'</div>';
for(j=0; j<5;j++){
if(j!=id){
x = document.getElementById(j);
x.innerHTML = '';
x.innerHTML = '<a onclick="gotoPage('+j+');" href="#">'+nameArr[j]+'</a>';
}
}
}
else if (document.all){
x = document.all[id];
x.innerHTML = '<div class="selTab">'+nameArr[id]+'</div>';
for(j=0; j<4;j++){
if(j!=id){
x = document.all[j];
x.innerHTML = '<a onclick="gotoPage('+j+');" href="#">'+nameArr[j]+'</a>'
}
}
}
}
</code>
function gotoPage(id) {
var nameArr = new Array("Home", "Articles", "Experiments", "Links", "About")
var linkArr = new Array("index.html", "HTML/articles.html", "HTML/experiments.html", "HTML/links.html", "HTML/about.html")
window.parent.location = linkArr[id]
if (document.getElementById){
x = document.getElementById(id);
//alert(x.innerHTML)
x.innerHTML = '';
x.innerHTML = '<div class="selTab">'+nameArr[id]+'</div>';
for(j=0; j<5;j++){
if(j!=id){
x = document.getElementById(j);
x.innerHTML = '';
x.innerHTML = '<a onclick="gotoPage('+j+');" href="#">'+nameArr[j]+'</a>';
}
}
}
else if (document.all){
x = document.all[id];
x.innerHTML = '<div class="selTab">'+nameArr[id]+'</div>';
for(j=0; j<4;j++){
if(j!=id){
x = document.all[j];
x.innerHTML = '<a onclick="gotoPage('+j+');" href="#">'+nameArr[j]+'</a>'
}
}
}
}
</code>
Comment