PDA

View Full Version : multiply this code...


pbcommun
08-27-2005, 04:44 PM
Let me start off by saying that i have NO knowledge of javascript....

There, now. Someone on another forum gave me this script to add two pulldown menus.

I need 5....

So, how do i "multiply" this to give me five dropdowns? Ive tried, and end up effing it all up. The tables within tables within divs within tables confuse me. :(



<table align="center">
<tr><td>
<table width="200" border="1" cellspacing="0" cellpadding="0" bordercolor="#d8d8d8">
<tr>
<td bgcolor="d8d8d8">
<font face="verdana" size="2"> Choose a link</font>
</td>
<td align="right" width="21"><A HREF="#" onclick="combo('contents')" >Menu</A></td>
</tr>
</table>
<div id="contents" style="position:absolute; left:?px; top:?px; width:?px; height:?px; z-index:1; visibility:hidden">
<table width="200" border="1" cellspacing="0" cellpadding="0" bordercolor="#d8d8d8">
<tr>
<td bgcolor="d8d8d8">
<font face="verdana" size="2">
<a href="http://javascript.internet.com" target="_blank">The Javascript Source</a><br>
<a href="http://www.wdvl.com/" target="_blank">WDVL</a><br>
<a href="http://webhost.thelist.com/" target="_blank">theList</a><br></font>
</td>
</tr>
</table>
</td></tr>
</table>
<table width="200" border="1" cellspacing="0" cellpadding="0" bordercolor="#d8d8d8">
<tr>
<td bgcolor="d8d8d8">
<font face="verdana" size="2"> Choose a link</font>
</td>
<td align="right" width="21">
<A HREF="#" onclick="combo('contents2')">Menu</A></td>
</tr>
</table>
<div id="contents2" style="position:absolute; left:?px; top:?px; width:?px; height:?px; z-index:1; visibility:hidden">
<table width="200" border="1" cellspacing="0" cellpadding="0" bordercolor="#d8d8d8">
<tr>
<td bgcolor="d8d8d8">
<font face="verdana" size="2">
<a href="http://javascript.internet.com" target="_blank">The Javascript Source</a><br>
<a href="http://www.wdvl.com/" target="_blank">WDVL</a><br>
<a href="http://webhost.thelist.com/" target="_blank">theList</a><br></font>
</td>
</tr>
</table>
</td></tr>
</table>

That's the code for two. Now, how about 5?

EDIT: okay guys, you REALLY need to turn html off....it keeps thinking im trying to post images, and it's saying "you have included too many images..." it's annoying :(

Bill
09-05-2005, 10:37 PM
Here is all the code you need for a dropdown menu:

<table width="200" border="1" cellspacing="0" cellpadding="0" bordercolor="#d8d8d8">
<tr>
<td bgcolor="d8d8d8">
<font face="verdana" size="2"> Choose a link</font>
</td>
<td align="right" width="21">
<A HREF="#" onclick="combo('contents')" >Menu</A>
</td></tr>
</table>


You need to copy this code 5 times and you will have 5 dropdown menus of the same kind.

The javascript that you have not provided only works for this part:
onclick="combo('contents')

You will need to add contents, contents1, contents2, contents3.. etc for the 5 menus separately in the javascript code.

If you provide me with the javascript code, I will assist you on that too.

Please reply here with any questions or comments.

Regards,

Bill
SiteGround Support Team

pbcommun
09-06-2005, 06:31 PM
Thank bill!

I dont really know if i will be using this dropdown menu on my site. It isnt firefox-friendly.

Here is the javascript-


<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: Roberto Ortali (ortiz83@libero.it) -->

<!-- Begin
// MODIFIED LOTS !!!!!!!!!!!!!!!!!!!!!
var refer=true;
function combo(id) {
obj=document.getElementById(id);
if (!obj.refer) {
obj.style.visibility="visible";
obj.refer=true;
}
else {
obj.style.visibility="hidden";
obj.refer=false;
}
}
// End -->
</script>

is it possible to make firefox like it?

Bill
09-06-2005, 08:58 PM
Hello,

I am not really sure why do you want to use a javascript based dropdown menu.

The HTML Language has a nice dropdown menu component itself.

I see that you dont feel comfortable in writing the code yourself, and this is why I can suggest you to create a dropdown menu here:
http://www.htmlbasix.com/dropmenu.shtml

This is a nice generator that will give you all the options and will generate the code that you need.

Please try it out and post here if you need further assistance with setting it up.

Regards,

Bill
SiteGround Support Team

pbcommun
09-08-2005, 10:14 PM
well....i know how to set up a simple html select, but that's quite different from what the javascript that im trying to use does.

You can see it here (if viewing with opera or IE)
http://paintplayers.com/smfthemes/hi.php

(click the links image)

This would allow me to easily display actuall content in 'popup' s .