Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-22-2005, 11:48 PM   PM User | #1
Frenzy
New to the CF scene

 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Frenzy is an unknown quantity at this point
menu problem

hi i would like help with this code below. it is a fading menu. when i remove the </tr> to make the menu horizontal instead of vertical.. the fading doesnt work anymore. Please help me correct the code. Thanks

<BODY>

<style>
. fm
{
background-Color:silver;
width:100;
height:20;
text-align:center;
border:1px solid gray;
font-size:14;
filter:alpha(opacity=45);
-moz-opacity:45%;
cursor:crosshair;
}
</style>

<script language="javascript">
nOpac = 50
nPlus = 2
nMin = 1
speed = 30
timer = null;
timer2 = null;

var ie5=(document.all && document.getElementById);
var ns6=(!document.all && document.getElementById);

function fadeImg2(teller)
{
apl[teller][1] = "Up";
changes();
}

function fadeImgend2(teller)
{
apl[teller][1] = "Down";
setTimeout("changes()",50);
}

function changes()
{
next_loop = true;
for (i=0;i<apl.length;i++)
{
obj = link_table.rows[i].cells[0];
opacity = apl[i][0]
if (apl[i][1] == "Up")
{
opacity += nPlus;
apl[i][0] = opacity;
if (apl[i][0] > 105)
{apl[i][1] = "";}
else
{next_loop = false;}
nOpac = opacity;
}
else
{
if (apl[i][1] == "Down")
{
opacity -= nMin;
apl[i][0] = opacity;
if (apl[i][0] < 45)
{apl[i][1] = "";}
else
{next_loop = false;}
nOpac = opacity;
}
}
if(ie5){
obj.style.filter="alpha(opacity="+opacity+")";
}
if(ns6){
obj.style.MozOpacity = opacity + '%';
}
}
if (next_loop == false)
{
timer = setTimeout("changes()",speed);
}
else
{
clearTimeout(timer);
}
}

//for each link option you need to make a new Array;
var apl = new Array();
apl[0] = new Array(45,"");
apl[1] = new Array(45,"");
apl[2] = new Array(45,"");
apl[3] = new Array(45,"");
apl[4] = new Array(45,"");
//expl: apl[5] = new Array(45,"");
</script>

<body>
<table style="border:0px; width:130;height:180" cellspacing=0 cellpadding=0>
<tr><td align=center border=0>
<table cellpadding=0 cellspacing=0 name=link_table id=link_table>
<tr>
<td class="fm" onmouseover="fadeImg2(0)" onmouseout="fadeImgend2(0)" onclick="window.location='#';" style="border:0px solid gray;background-color:silver;width:100;text-align:center">Profile</td>
</tr>
<tr>
<td class="fm" onmouseover="fadeImg2(1)" onmouseout="fadeImgend2(1)" onclick="window.location='#';" style="border:0px solid gray;background-color:silver;width:100;text-align:center">Entries</td>
</tr>
<tr>
<td class="fm" onmouseover="fadeImg2(2)" onmouseout="fadeImgend2(2)" onclick="window.location='#';" style="border:0px solid gray;background-color:silver;width:100;text-align:center">Tagboard</td>
</tr>
<tr>
<td class="fm" onmouseover="fadeImg2(3)" onmouseout="fadeImgend2(3)" onclick="window.location='#';" style="border:0px solid gray;background-color:silver;width:100;text-align:center">Links</td>
</tr>
<tr>
<td class="fm" onmouseover="fadeImg2(4)" onmouseout="fadeImgend2(4)" onclick="window.location='#';" style="border:0px solid gray;background-color:silver;width:100;text-align:center">Archives</td>
</tr>
</table>
</td></tr></table><!-- total time: 0 wallclock secs ( 0.04 usr + 0.01 sys = 0.05 CPU) -->
<!-- 0 sql queries used -->
Frenzy is offline   Reply With Quote
Old 09-29-2005, 09:47 AM   PM User | #2
By@
New Coder

 
Join Date: Sep 2005
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
By@ is an unknown quantity at this point
After removing the <tr> tags, replace the line:
Code:
obj = link_table.rows[i].cells[0];
with:

Code:
obj = link_table.cells[i];
__________________
I suggest reading this.
By@ is offline   Reply With Quote
Old 09-29-2005, 08:16 PM   PM User | #3
Frenzy
New to the CF scene

 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Frenzy is an unknown quantity at this point
Thumbs up

neat.. thanks..
Frenzy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:11 PM.


Advertisement
Log in to turn off these ads.