PDA

View Full Version : Scrollable Menu Links - mulitple menus



webwonder
08-10-2008, 09:30 AM
1) Script Title: Scrollable Menu Links

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/scrollerlink.htm#

3) Describe problem: I wish to use this script on different pages of a site with a different menu list. Is it a case that i will have to use the same script with a different name and change the menu list accordingly (so i have a different script for each page), or is there a way this script can be modified so that i can use the one script for the different menu items.

hope the above makes sense.

thanks

jscheuer1
08-10-2008, 09:40 AM
I'm assuming you mean because you intend to use this as an external script file. Since the links and other configuration variables:


//configure path for left and right arrows
var goleftimage='pointer2.gif'
var gorightimage='pointer.gif'
//configure menu width (in px):
var menuwidth=300
//configure menu height (in px):
var menuheight=25
//Specify scroll buttons directions ("normal" or "reverse"):
var scrolldir="normal"
//configure scroll speed (1-10), where larger is faster
var scrollspeed=6
//specify menu content
var menucontents='<nobr><a href="http://www.dynamicdrive.com">Dynamic Drive</a> | <a href="http://www.javascriptkit.com">JavaScript Kit</a> | <a href="http://www.codingforums.com">CodingForums.com</a> | <a href="http://www.builder.com">Builder.com</a> | <a href="http://freewarejava.com">Freewarejava.com</a></nobr>'


are globals, you could just omit one or more of them from the script. Then link the script to as many pages as you like, just define the omitted values on (or linked externally to) those pages before the external script tag for the main script.

webwonder
08-10-2008, 09:49 AM
ok you lost me a little - new to this, yes i am using it as an external script

do you mean i could take the "var menucontents" out of the main script altogether and put into another file call it blah.js and link this whilst also linking the main script. At the moment i call the main script like below where i want the menu to appear. How would i call the script that just contained the global variable - if that is what you meant?

<script type="text/javascript" src="script/menu.js">
/***********************************************
* Scrollable Menu Links- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>

jscheuer1
08-10-2008, 10:01 AM
Yes, that's essentially what I meant, you could do it this way:


<script type="text/javascript" src="script/blah.js"></script>
<script type="text/javascript" src="script/menu.js">
/***********************************************
* Scrollable Menu Links- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>

webwonder
08-10-2008, 10:06 AM
brilliant - thank you so much, and for such a quick response

nikki