Folks
I have an html file which looks like this:
..
..
..
<body onLoad="WindowO nLoad();">
..
..
..
<div id="strategy_as p" style="visibili ty:hidden;">HTM L CODE HERE</div>
<div id="organisatio n_asp" style="visibili ty:hidden;">HTM L CODE
HERE</div>
<div id ="people.asp " style="visibili ty:hidden;">HTM L CODE HERE</div>
..
..
..
I also have a javascript function which retrieves the URL of the page
you're on and should then display the appropriate content for that
page:
function WindowOnLoad() {
// this function will detect what page I am on using the javascript
href function
// and then depending on the outcome, it will switch the <div> tag for
that particular page
// on or off
var src = self.location.h ref;
src = (src.substring( src.lastIndexOf ("/") + 1,
src.length).toL owerCase());
// replace "." in URL with "_"
src = src.replace('.' , '_')
if (document.layer s) {
eval("document. layers['" + src + "'].style.visibili ty = 'show';");
} else if(document.all ) {
eval("document. all." + src + ".style.visibil ity = 'visible'");
} else if(document.get ElementById) {
eval("document. getElementById( '" + src + "').style.style .visibility =
'visible';");
}
}
However, I keep getting this error when I click on strategy.asp, for
example:
document.all.st rategy_asp.styl e is null or not an object
This is infuriating. What am I doing wrong???
I have an html file which looks like this:
..
..
..
<body onLoad="WindowO nLoad();">
..
..
..
<div id="strategy_as p" style="visibili ty:hidden;">HTM L CODE HERE</div>
<div id="organisatio n_asp" style="visibili ty:hidden;">HTM L CODE
HERE</div>
<div id ="people.asp " style="visibili ty:hidden;">HTM L CODE HERE</div>
..
..
..
I also have a javascript function which retrieves the URL of the page
you're on and should then display the appropriate content for that
page:
function WindowOnLoad() {
// this function will detect what page I am on using the javascript
href function
// and then depending on the outcome, it will switch the <div> tag for
that particular page
// on or off
var src = self.location.h ref;
src = (src.substring( src.lastIndexOf ("/") + 1,
src.length).toL owerCase());
// replace "." in URL with "_"
src = src.replace('.' , '_')
if (document.layer s) {
eval("document. layers['" + src + "'].style.visibili ty = 'show';");
} else if(document.all ) {
eval("document. all." + src + ".style.visibil ity = 'visible'");
} else if(document.get ElementById) {
eval("document. getElementById( '" + src + "').style.style .visibility =
'visible';");
}
}
However, I keep getting this error when I click on strategy.asp, for
example:
document.all.st rategy_asp.styl e is null or not an object
This is infuriating. What am I doing wrong???
Comment