riptide
06-10-2008, 11:23 PM
I'm really not sure what I'm doing wrong I'm not sure how to set this up.
I started out with an object that holds all the vars for the Div tags in the code. then I needed to find out what link was clicked in a table.
So I tried to have only the links in the table by the name of navi checked with Wile.
if they were the link that was clicked it then moves the div down when it gets to a number down it stops. when the user moves the mouse away from the div a function is called to undo the movement.
there are other divs in this table so I was trying to make the code smaller.
I think I don't understand the this. property that well.
can some one tell me where the code is set up wrong. I'm sure there is a way to do this.
function siteNavi() {
this.UpValue = 70;
this.downValue = 20;
this.theDoc = document.getElementById('sectab').style;
this.theDocA = document.getElementById('sectab2').style;
this.theDocB = document.getElementById('sectab3').style;
this.theDocC = document.getElementById('sectab4').style;
this.theDocD = document.getElementById('sectab5').style;
this.theDocE = document.getElementById('sectab6').style;
this.theDocF = document.getElementById('sectab7').style;
}
function filink(e){
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
return false;
}
if (links[i].parentNode.parentNode.parentNode.class==navbase)
{
switch (e){
case "links[0]":
this.theDoc.top=this.UpValue+'px'
UpValue++;
if (this.UpValue==76)
{this.theDoc.display='block'};
if (this.UpValue<90)
{setTimeout('show()',10)};
function clap(){
setTimeout('redo()',1000);
}
function redo(){
this.theDoc.top=this.downValue+'px';
this.downValue--;
if (this.downValue<69)
setTimeout('redo()',10);
if (this.downValue==1)
this.theDoc.display='none';
}
break;
case "links[1]":
break;
case "":
break;
}
} else{}
The table and Div never mind everything that is in the divs. the function only moves it. the links are in the table
<table class="navbase" align="center" summary="This table holds the links.
You need a browser to that handles java script" bgcolor="" cellpadding="2px" cellspacing="12px">
<tr>
<td bgcolor="#B69F01" ><a href="#" >Click me</a> </td>
</tr>
<tr>
<td bgcolor="#B69F01"> <a href="#" >Click me too</a> </td>
</tr></table>
<div id="sectab" onmouseover="" onmouseout=" clap()">
<ul class="navlinklist" >
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
<!--end of sectab-->
<!--sectab2-->
<div id="sectab2" onmouseover="" onmouseout=" clap()">
<ul class="navlinklist">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
I started out with an object that holds all the vars for the Div tags in the code. then I needed to find out what link was clicked in a table.
So I tried to have only the links in the table by the name of navi checked with Wile.
if they were the link that was clicked it then moves the div down when it gets to a number down it stops. when the user moves the mouse away from the div a function is called to undo the movement.
there are other divs in this table so I was trying to make the code smaller.
I think I don't understand the this. property that well.
can some one tell me where the code is set up wrong. I'm sure there is a way to do this.
function siteNavi() {
this.UpValue = 70;
this.downValue = 20;
this.theDoc = document.getElementById('sectab').style;
this.theDocA = document.getElementById('sectab2').style;
this.theDocB = document.getElementById('sectab3').style;
this.theDocC = document.getElementById('sectab4').style;
this.theDocD = document.getElementById('sectab5').style;
this.theDocE = document.getElementById('sectab6').style;
this.theDocF = document.getElementById('sectab7').style;
}
function filink(e){
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
return false;
}
if (links[i].parentNode.parentNode.parentNode.class==navbase)
{
switch (e){
case "links[0]":
this.theDoc.top=this.UpValue+'px'
UpValue++;
if (this.UpValue==76)
{this.theDoc.display='block'};
if (this.UpValue<90)
{setTimeout('show()',10)};
function clap(){
setTimeout('redo()',1000);
}
function redo(){
this.theDoc.top=this.downValue+'px';
this.downValue--;
if (this.downValue<69)
setTimeout('redo()',10);
if (this.downValue==1)
this.theDoc.display='none';
}
break;
case "links[1]":
break;
case "":
break;
}
} else{}
The table and Div never mind everything that is in the divs. the function only moves it. the links are in the table
<table class="navbase" align="center" summary="This table holds the links.
You need a browser to that handles java script" bgcolor="" cellpadding="2px" cellspacing="12px">
<tr>
<td bgcolor="#B69F01" ><a href="#" >Click me</a> </td>
</tr>
<tr>
<td bgcolor="#B69F01"> <a href="#" >Click me too</a> </td>
</tr></table>
<div id="sectab" onmouseover="" onmouseout=" clap()">
<ul class="navlinklist" >
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
<!--end of sectab-->
<!--sectab2-->
<div id="sectab2" onmouseover="" onmouseout=" clap()">
<ul class="navlinklist">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>