...

View Full Version : Need Two Or More Of Same Script On Page



TNCARROLLS
02-22-2003, 05:49 AM
I Need Help Putting This Code Mutiple Times On Page.I Am A Newbe To Scripting And Need Some Help.I Am Making A Links Page And Would Like To Use This Link Scroller For Each Site.Heres The Code;<style>
body{
overflow-x:hidden;
overflow-y:scroll;
}
</style>

<script language="JavaScript1.2">

/*
Scrollable Menu Links- By Dynamicdrive.com
For full source, TOS, and 100s DTHML scripts
Visit http://dynamicdrive.com
*/

//configure path for left and right arrows
var goleftimage='pointer2.gif'
var gorightimage='pointer.gif'
//configure menu width
var menuwidth=300
//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://wsabstract.com">Website Abstraction</a> | <a href="http://www.codearena.com">CodeArena.com</a> | <a href="http://www.builder.com">Builder.com</a> | <a href="http://freewarejava.com">Freewarejava.com</a></nobr>'


////NO NEED TO EDIT BELOW THIS LINE////////////

var actualwidth=''
var ns_scroll
function fillup(){
if (document.all){
test2.innerHTML=menucontents
actualwidth=test2.offsetWidth
}
else if (document.layers){
ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2
ns_scroll.document.write(menucontents)
ns_scroll.document.close()
actualwidth=ns_scroll.document.width
}
}
window.onload=fillup

function moveleft(){
if (document.all&&test2.style.pixelLeft>(menuwidth-actualwidth))
test2.style.pixelLeft-=scrollspeed
else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth))
ns_scroll.left-=scrollspeed
lefttime=setTimeout("moveleft()",50)
}

function moveright(){
if (document.all&&test2.style.pixelLeft<0)
test2.style.pixelLeft+=scrollspeed
else if (document.layers&&ns_scroll.left<0)
ns_scroll.left+=scrollspeed
righttime=setTimeout("moveright()",50)
}

if (document.all||document.layers){
with (document){
write('<table border="0" cellspacing="0" cellpadding="0">')
write('<td valign="middle"><a href=#" onMouseover="moveleft()" onMouseout="clearTimeout(lefttime)"><img src="'+goleftimage+'"border=0></a>&nbsp;</td>')
write('<td valign="top">')
if (document.all){
write('<span style="position:relative;width:'+menuwidth+';">')
write('<span style="position:absolute;width:'+menuwidth+';clip:rect(0 '+menuwidth+' auto 0)">')
write('<span id="test2" style="position:absolute;left:0;top:0">')
write('</span></span></span>')
}
else if (document.layers){
write('<ilayer width='+menuwidth+' name="ns_scrollmenu">')
write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>')
}
write('</td>')
write('<td valign="middle">&nbsp;<a href="#" onMouseover="moveright()" onMouseout="clearTimeout(righttime)">')
write('<img src="'+gorightimage+'"border=0></a>')
write('</td></table>')
}
}
</script>
If Anyone Can Help Me I Thank You So Much:o

Skyzyx
02-22-2003, 07:29 PM
It's not very clear what exactly you're trying to do...

P.S. There's a newer version of the same script at www.dynamicdrive.com that supports current browsers too...

TNCARROLLS
02-22-2003, 08:23 PM
What Im Trying To Do Is Have A Section For Each Sites Logo And Above This Logo I Would Like To Put This Scroller For Their Links.Mutiple Pages On Same Site i.e. Internet Tools Page,System Tools Page,etc.... Every Time I Add More Than One Of These Codes First Script Does Not Show Links In Middle Of Scroller And Right Arrow Gif Acts Like A "Back To Top Script". This Script Does Not Have A "body onload Tag i.e. dothis,dothat" I Dont Know If This Script Is Able To Be Used More Than Once On Same Page.I Tried To Rename This Script To Act Like To Different Scripts i.e Change Variables To No Effect.I Hope This Is Enough Info On THe Subject And Appolagize For Being So Wet Behind Ears.I Am A Copy And Paste Kind Of Guy And Only Been Useing My Computer For 3 Months So Im Still A baby At This.:confused:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum