| | |
Javascript causes page to crash
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi all i will try to be as clear as possible!
I am currently working on a site for a customer at www.privacymaker.com/gcs/dev/ (where im developing it, the main site location is www.gerbercentral.com)
well here is the issue i am running into.
I have decided to go with mouseovers that change the innerHTML of an element, at first if you tried to mouse over the tags while the page was loading it would cause the page to abort loading and you would get an error message.
I decided that it may be due to me trying to reference an HTML element that had not been drawn yet.
so i inserted the line
thinking that it would only execute the script if it could find the required element and only if the browser supported it...well i guess i was wrong because i am still getting crashes.
here is a copy of important HTML and the javascript file itself
[html]
<div align="justify">
<font class="navigation">
<a href="./networking.php" onMouseOver="displayNav( 'networking', '1' )" onMouseOut="restoreNav()">Networking</a> |
<a href="./hardsoft.php" onMouseOver="displayNav( 'hardwaresoftware', '1')" onMouseOut="restoreNav()">Hardware/Software</a> |
<a href="./viruses.php" onMouseOver="displayNav('virus', '1')" onMouseOut="restoreNav()">Viruses</a> |
<a href="./os.php" onMouseOver="displayNav('os', '1')" onMouseOut="restoreNav()">Operating Systems</a> |
<a href="./helpticket.php" onMouseOver="displayNav('webhelp', '1')" onMouseOut="restoreNav()">Web Based Help Tickets</a> |
<a href="./webdesign.php" onMouseOver="displayNav('webdes', '1')" onMouseOut="restoreNav()">Web Design</a> |
<a href="./training.php" onMouseOver="displayNav('training', '1')" onMouseOut="restoreNav()">Training</a>
</font>
<font id="LOGIN"><font class="login">
<a href="./login.php">Customer Login</a>
</font></font>
</div>[/html]
this calls the functions and here are the functions
[html]
function displayNav( location, level )
{
var path;
//if the document has not loaded yet do NOT do this procedure
//will cause a browser crash due to elements needed not being renderd yet
if(document.getElementById && document.getElementById("LEFTNAV") && document.getElementById("navhead")){ //is required piece loaded?
stopDelay();
//check to see what level they are on
if(level == 1) {
//top level directory
path = "./";
path += location;
} else {
//level two
path = "../";
path += location;
}
switch(location)
{
case "networking":
document.getElementById("LEFTNAV").innerHTML = "<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Wire(less) Networking</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Microsoft Servers</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Linux Servers</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">VLAN / VPN</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Cable Installation</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Network Hardware Setup</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Remote Support</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Networking</font>"
break
case "hardwaresoftware":
document.getElementById("LEFTNAV").innerHTML = "<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\" ><font class=\"navtext\"><a href=\"#\">Install/Removal</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Upgrades</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Hardware Cleaning</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Troubleshooting</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Data Backup</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Recovery Disks</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Drivers Disk</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Hardware/Software</font>"
break
case "virus":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Detection and Removal</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Preventative Software</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Adware / Spyware</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Preventative Maintanence</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Viruses</font>"
break
case "os":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Microsoft Windows</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Linux</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Macintosh</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Operating Systems</font>"
break
case "webhelp":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Web Based Help Tickets</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Online Help Tickets</font>"
break
case "webdes":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Logo Design</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Web Scripting</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Database Work</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Layouts</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Templates</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Shopping Carts</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Web Design</font>"
break
case "training":document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Windows OS</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Universal Linux/Unix Training</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Office Suites Training</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">PC Security</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Preventative Maintanence</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Heald College Cisco Certification</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Training</font>"
break
default:
restoreNav();}
}
}
[/html]
and the other function
[html]
var timer;
function restoreNav(){
{
stopDelay();
timer = setTimeout("restore()", 1250);
delete timer;
}
function restore()
{
if(document.getElementById && document.getElementById("LEFTNAV")) { //only restor nav if they are using IE5+ or NS6 or Some version of FireFox
document.getElementById("LEFTNAV").innerHTML = currentSection;
document.getElementById("navhead").innerHTML = currentHead;
}
}
function stopDelay(){
//clear the timer
if(typeof timer == 'undefined'){
//nothing to stop
}
else{clearTimeout(timer);}
}
[/html]
I am currently working on a site for a customer at www.privacymaker.com/gcs/dev/ (where im developing it, the main site location is www.gerbercentral.com)
well here is the issue i am running into.
I have decided to go with mouseovers that change the innerHTML of an element, at first if you tried to mouse over the tags while the page was loading it would cause the page to abort loading and you would get an error message.
I decided that it may be due to me trying to reference an HTML element that had not been drawn yet.
so i inserted the line
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
document.getElementById && document.getElementById("LEFTNAV")) {//continue code}
thinking that it would only execute the script if it could find the required element and only if the browser supported it...well i guess i was wrong because i am still getting crashes.
here is a copy of important HTML and the javascript file itself
[html]
<div align="justify">
<font class="navigation">
<a href="./networking.php" onMouseOver="displayNav( 'networking', '1' )" onMouseOut="restoreNav()">Networking</a> |
<a href="./hardsoft.php" onMouseOver="displayNav( 'hardwaresoftware', '1')" onMouseOut="restoreNav()">Hardware/Software</a> |
<a href="./viruses.php" onMouseOver="displayNav('virus', '1')" onMouseOut="restoreNav()">Viruses</a> |
<a href="./os.php" onMouseOver="displayNav('os', '1')" onMouseOut="restoreNav()">Operating Systems</a> |
<a href="./helpticket.php" onMouseOver="displayNav('webhelp', '1')" onMouseOut="restoreNav()">Web Based Help Tickets</a> |
<a href="./webdesign.php" onMouseOver="displayNav('webdes', '1')" onMouseOut="restoreNav()">Web Design</a> |
<a href="./training.php" onMouseOver="displayNav('training', '1')" onMouseOut="restoreNav()">Training</a>
</font>
<font id="LOGIN"><font class="login">
<a href="./login.php">Customer Login</a>
</font></font>
</div>[/html]
this calls the functions and here are the functions
[html]
function displayNav( location, level )
{
var path;
//if the document has not loaded yet do NOT do this procedure
//will cause a browser crash due to elements needed not being renderd yet
if(document.getElementById && document.getElementById("LEFTNAV") && document.getElementById("navhead")){ //is required piece loaded?
stopDelay();
//check to see what level they are on
if(level == 1) {
//top level directory
path = "./";
path += location;
} else {
//level two
path = "../";
path += location;
}
switch(location)
{
case "networking":
document.getElementById("LEFTNAV").innerHTML = "<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Wire(less) Networking</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Microsoft Servers</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Linux Servers</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">VLAN / VPN</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Cable Installation</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Network Hardware Setup</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Remote Support</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Networking</font>"
break
case "hardwaresoftware":
document.getElementById("LEFTNAV").innerHTML = "<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\" ><font class=\"navtext\"><a href=\"#\">Install/Removal</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Upgrades</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Hardware Cleaning</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Troubleshooting</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Data Backup</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Recovery Disks</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Drivers Disk</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Hardware/Software</font>"
break
case "virus":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Detection and Removal</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Preventative Software</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Adware / Spyware</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Preventative Maintanence</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Viruses</font>"
break
case "os":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Microsoft Windows</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Linux</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Macintosh</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Operating Systems</font>"
break
case "webhelp":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Web Based Help Tickets</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Online Help Tickets</font>"
break
case "webdes":
document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Logo Design</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Web Scripting</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Database Work</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Layouts</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Templates</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Shopping Carts</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Web Design</font>"
break
case "training":document.getElementById("LEFTNAV").innerHTML ="<table align=\"left\" class=\"rpxtable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Windows OS</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Universal Linux/Unix Training</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Office Suites Training</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">PC Security</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Preventative Maintanence</a></font></td></tr><tr><td class=\"shader\"></td></tr><tr><td height=\"21px\" onMouseOver=\"this.className='yellowBG'\" onMouseOut=\"this.className='normal'\"><font class=\"navtext\"><a href=\"#\">Heald College Cisco Certification</a></font></td></tr><tr><td class=\"shader\"></td></tr></table>"
document.getElementById("navhead").innerHTML = "<font class=\"header\">Training</font>"
break
default:
restoreNav();}
}
}
[/html]
and the other function
[html]
var timer;
function restoreNav(){
{
stopDelay();
timer = setTimeout("restore()", 1250);
delete timer;
}
function restore()
{
if(document.getElementById && document.getElementById("LEFTNAV")) { //only restor nav if they are using IE5+ or NS6 or Some version of FireFox
document.getElementById("LEFTNAV").innerHTML = currentSection;
document.getElementById("navhead").innerHTML = currentHead;
}
}
function stopDelay(){
//clear the timer
if(typeof timer == 'undefined'){
//nothing to stop
}
else{clearTimeout(timer);}
}
[/html]
Dont forget to spread the reputation to those that deserve!
![]() |
Similar Threads
- Passing variable value from javascript to jsp page at run time (JSP)
- change the font/color of the selected text on a web page through javascript (JavaScript / DHTML / AJAX)
- Javascript/VBScript within VB6 application (Visual Basic 4 / 5 / 6)
- Conflicting javascript slideshows on same page (JavaScript / DHTML / AJAX)
- Getting data from ASP page A to ASP page B using javascript (ASP.NET)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: javascript image animation not working????
- Next Thread: Are U Sing Dreamweaver?
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser bug captchaformproblem cart checkbox child class close codes createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming progressbar prototype redirect runtime safari scale scriptlets scroll search security shopping size software toggle unicode w3c web wysiwyg \n





