Forum Moderators: open
But if we are on the incorrect page, I change the location.href (1st arg) and then I want to hide/show <div>s on the loaded page, as I do above. The page loads fine and I can see the coreect <div> show a fraction of a second but then it disappears.
Is it something with the onload or...? Thanks!
function openInternal(projSize,area) {
. //Get file name
. fileName = getFileName(location.href, "/");
. if (fileName.indexOf(projSize) != -1) {
. . // On the right page, now hide/show div!
. . showActivity(area);
. } else { // Wrong page, load other page
. . window.location.href = "basics."+projSize+".html";
. . checkLoad(area);
. }
}
function getFileName(fullString, subString) {
. if (fullString.lastIndexOf(subString) == -1) {
. . return "";
. } else {
. . return fullString.substring(fullString.lastIndexOf(subString)+1, fullString.length);
. }
}
function checkLoad(area) {
. if (window.onLoad) {
. . showActivity(area);
. } else {
. . setTimeout("checkLoad(area);", 100)
. }
}
function showActivity(area) {
. var allDivs = document.getElementsByTagName("div");
. for (i=0; i<allDivs.length; i++) {
. . if (allDivs[i].className == "activityContainer" ¦¦ allDivs[i].className == "introduction") {
. . . allDivs[i].style.display = 'none';
. . }
. }
. document.getElementById(area).style.display = "block";
}