View Full Version : 1 js file for 2 type of menu!

02-17-2006, 10:18 AM
Please help me!

//This script is in one.js file

//Link menu
var url1='<A href=';
var url2='</A><BR>';

//Pulldown menu
pull='<option value=';

var mylink=new Array()
mylink[0]='http://www.domain.com/myself.html>About Me'
mylink[0]+='http://www.domain.com/mypix.html>My Picture'
mylink[0]+='http://www.domain.com/clink.html>Cool Link'

var normalinkmenu=url1+mylink[0]+url2;

/* The script should run something like this:
<A href=http://www.domain.com/myself.html>About Me</A><BR>
<A href=http://www.domain.com/mypix.html>My Picture</A><BR>
<A href=http://www.domain.com/clink.html>Cool Link</A><BR>
var pulldownmenu='pull+mylink';
/* The script should run something like this:
<OPTION value=http://www.domain.com/myself.html>About Me
<OPTION value=http://www.domain.com/mypix.html>My Picture
<OPTION value=http://www.domain.com/clink.html>Cool Link
//There's more work to make pulldownmenu work, such as onchange or onclick. I can take that!

Place one.js file in a html file.
<SCRIPT src="one.js" type="text/javascript"></SCRIPT>
<SCRIPT language="JavaScript">document.write(normalinkmenu);</SCRIPT>
//Or pulldownmenu

The reason I want to make this script because I want to use the same url and name with diffent type me menu (normal link & pulldown menu). So I want to edit, I only need to edit one file.

Thank You Very Much!