AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Navigation Script HELP!!

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.javascript
View previous topic :: View next topic  
Author Message
Ben Allen
Guest





PostPosted: Mon Nov 10, 2003 3:56 pm    Post subject: Navigation Script HELP!! Reply with quote



I have a website that uses layers for a navigational effect the javascript
file has the following code:
var activeSub=0;
var SubNum=0;

function reDo(){ window.location.reload() }
window.onresize = reDo;


//Define global variables

var timerID = null;
var timerOn = false;
var timecount = 1000;
var what = null;
var newbrowser = true;
var check = false;

function init(){
// alert ("Running Init");
if (document.layers) {
// alert ("Running Netscape 4");
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
screenSize = window.innerWidth;
what ="ns4";


}else if(document.all){
// alert ("Running IE");
layerRef="document.all";
styleSwitch=".style";
visibleVar="visible";
screenSize = document.body.clientWidth + 18;
what ="ie";

}else if(document.getElementById){
// alert ("Running Netscape 6");
layerRef="document.getElementByID";
styleSwitch=".style";
visibleVar="visible";
what="moz";

}else{
//alert("Older than 4.0 browser.");
what="none";
newbrowser = false;
}


window.status='status bar text to go here';
check = true;
}

// Turns the layers on and off
function showLayer(layerName){
if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="visible";
}
else{

eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
}
else {// alert ("Please wait for the page to finish loading.");
return;}
}

function hideLayer(layerName){
if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="hidden";
}
else{

eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}

}
else {// alert ("Please wait for the page to finish loading.");
return;}
}


function hideAll(){
hideLayer('layer1');
hideLayer('layer2');
hideLayer('layer3');
hideLayer('layer4');
hideLayer('layer5');
hideLayer('layer6');
hideLayer('layer7');
hideLayer('layer8');
}


function startTime() {
if (timerOn == false) {
timerID=setTimeout( "hideAll()" , timecount);
timerOn = true;

}

}


function stopTime() {
if (timerOn) {
clearTimeout(timerID);
timerID = null;
timerOn = false;
}
}

function onLoad(){
init();

}

My HTML file says:
html>

<head>
<link rel="stylesheet" type="text/css" href="main.css">
<script language="JavaScript" type="text/javascript" src="nav.js"></script>
<title>Home</title>
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>

<body onLoad="init();" bgcolor="#666666">
<table border="0" width="100%" cellspacing="0" cellpadding="0"
align="center" height="96%">
<tr>
<td width="181" valign="top" align="center" height="526" rowspan="3">
<table border="0" width="179" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><img border="0" src="nav-top.gif" width="181"
height="130"></td>
</tr>
<tr>
<td width="100%" height="168">
<table border="0" width="181" cellspacing="0" cellpadding="0">
<tr>
<td width="90" background="nav-leftB.gif" valign="top"
height="166"><img border="0" src="nav-leftA.gif" width="90"
height="150"></td>
<td width="91" valign="top" bgcolor="#636363" height="166">
<p><img border="0" src="button1.gif" width="86"
height="34"><img border="0" src="button2.gif" width="86" height="35"><img
border="0" src="button1.gif" width="86" height="34"><img border="0"
src="button2.gif" width="86" height="35"><img border="0" src="button1.gif"
width="86" height="34"></p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%"><img border="0" src="nav-cap.gif" width="180"
height="30"></td>
</tr>
</table>
<div align="center">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><a href="www.guistuff.com"><img border="0" src="gui.gif"
width="105" height="78"></a></p>
</div>
</td>
<td valign="top" height="78" colspan="4"> <img border="0"
src="title.gif" width="269" height="80">
</td>
</tr>
<tr>
<td width="205" valign="middle" height="35" align="center">
<div align="center"><font color="#000000">Home</font></div>
</td>
<td width="205" valign="middle" height="35" align="center">
<a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()"
onMouseOut="startTime();"> <div align="center"><font
color="#000000">Series 40</font>
</div> </a>
</td>
<td width="205" valign="middle" height="35" align="center">
<a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()"
onMouseOut="startTime();"> <div align="center"><font color="#000000">PC
Software</font>
</div> </a>
</td>
<td width="205" valign="middle" height="35" align="center">
<a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()"
onMouseOut="startTime();"> <div align="center"><font
color="#000000">Misc</font>
</div> </a>
</td>
</tr>
<tr>
<td valign="top" height="418" colspan="4">
<div id="Layer2" style="position:absolute; width:67px; height:23px;
z-index:2; left: 652px; top: 121px; background-color: #CCCCCC;
layer-background-color: #CCCCCC; border: 1px none #000000; visibility: ;
visibility: hidden">-Software</div>
<div id="Layer3" style="position:absolute; width:89px; height:41px;
z-index:3; left: 883px; top: 121px; background-color: #CCCCCC;
layer-background-color: #CCCCCC; border: 1px none #000000; visibility:
hidden">
- Links

- Contact Me</div>
</td>
</tr>
</table>
<div id="Layer1" style="position:absolute; width:95px; height:102px;
z-index:1; left: 462px; top: 121px; background-color: #CCCCCC;
layer-background-color: #CCCCCC; border: 1px none #000000; visibility:
hidden">
- Phones

- Games

- Apps

- Backgrounds

- Ringtones </div>
</body>

</html>

Every time i run it i get an error can you help me please?

Thanks to all in advance,
Ben Allen



Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.javascript All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.