PDA

View Full Version : Scrollable Menu Links



radu706
11-01-2008, 04:12 PM
hei, first of all sry for my bad english.

my probl: I want to use same script on same page. the problem is that only the last box displays the menucontents
can someone help me?
tx

p.s.: [I use and php on my page]

exemple:

<?
$matrice=array('meniu1', 'meniu2' .... 'meniu15');
foreach ($matrice as $name){
?>
<script type="text/javascript">

/***********************************************
* 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
***********************************************/

//configure path for left and right arrows
var goleftimage<? echo $name;?>='images/left.jpg'
//
var gorightimage<? echo $name;?>='images/right.jpg'
//configure menu width (in px):
var menuwidth<? echo $name;?>=300
//configure menu height (in px):
var menuheight<? echo $name;?>=25
//Specify scroll buttons directions ("normal" or "reverse"):
var scrolldir<? echo $name;?>="normal"
//configure scroll speed (1-10), where larger is faster
var scrollspeed<? echo $name;?>=6
//specify menu content
var menucontents<? echo $name;?>='<? echo $ceva;?>'
// $ceva is diferit for ecah $name [php part is ok]

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

var iedom<? echo $name;?>=document.all||document.getElementById
//
var leftdircode<? echo $name;?>='onMouseover="moveright<? echo $name;?>()" onMouseout="clearTimeout(righttime<? echo $name;?>)"'
//
var rightdircode<? echo $name;?>='onMouseover="moveleft<? echo $name;?>()" onMouseout="clearTimeout(lefttime<? echo $name;?>)"'
//
if (scrolldir<? echo $name;?>=="reverse"){
//
var tempswap<? echo $name;?>=leftdircode<? echo $name;?>
//
leftdircode<? echo $name;?>=rightdircode<? echo $name;?>
//
rightdircode<? echo $name;?>=tempswap<? echo $name;?>
//
}
//

//
if (iedom<? echo $name;?>)
//
document.write('<span id="temp<? echo $name;?>" style="visibility:hidden;position:absolute;width:10px;">'+menucontents<? echo $name;?>+'</span>')
//
var actualwidth<? echo $name;?>=''
//
var cross_scroll<? echo $name;?>
//
var ns_scroll
//
var loadedyes<? echo $name;?>=0
//
function fillup<? echo $name;?>(){
//
if (iedom<? echo $name;?>){
//
cross_scroll<? echo $name;?>=document.getElementById? document.getElementById("test2<? echo $name;?>") : document.all.test2<? echo $name;?>
//
cross_scroll<? echo $name;?>.innerHTML='<nobr>'+menucontents<? echo $name;?>+'</nobr>'
//
actualwidth<? echo $name;?>=document.all? cross_scroll<? echo $name;?>.offsetWidth : document.getElementById("temp<? echo $name;?>").offsetWidth
//
}
//
else if (document.layers){
//
ns_scroll=document.ns_scrollmenu<? echo $name;?>.document.ns_scrollmenu2<? echo $name;?>
//
ns_scroll.document.write(menucontents<? echo $name;?>)
//
ns_scroll.document.close()
//
actualwidth<? echo $name;?>=ns_scroll.document.width
//
}
//
loadedyes<? echo $name;?>=1
//
}
//
window.onload=fillup<? echo $name;?>
//

function moveleft<? echo $name;?>(){
//
if (loadedyes<? echo $name;?>){
//
if (iedom<? echo $name;?>&&parseInt(cross_scroll<? echo $name;?>.style.left)>(menuwidth<? echo $name;?>-actualwidth<? echo $name;?>)){
//
cross_scroll<? echo $name;?>.style.left=parseInt(cross_scroll<? echo $name;?>.style.left)-scrollspeed<? echo $name;?>+"px"
//
}
//
else if (document.layers&&ns_scroll.left>(menuwidth<? echo $name;?>-actualwidth<? echo $name;?>))
//
ns_scroll.left-=scrollspeed<? echo $name;?>
//
}
//
lefttime<? echo $name;?>=setTimeout("moveleft<? echo $name;?>()",50)
//
}
//

function moveright<? echo $name;?>(){
//
if (loadedyes<? echo $name;?>){
//
if (iedom<? echo $name;?>&&parseInt(cross_scroll<? echo $name;?>.style.left)<0)
//
cross_scroll<? echo $name;?>.style.left=parseInt(cross_scroll<? echo $name;?>.style.left)+scrollspeed<? echo $name;?>+"px"
//
else if (document.layers&&ns_scroll.left<0)
//
ns_scroll.left+=scrollspeed<? echo $name;?>
//
}
//
righttime<? echo $name;?>=setTimeout("moveright<? echo $name;?>()",50)
//
}
//


if (iedom<? echo $name;?>||document.layers){
//
with (document){
//
write('<table border="1" cellspacing="0" cellpadding="2">')
//
write('<td valign="middle"><a href="#" '+leftdircode<? echo $name;?>+'><img src="'+goleftimage<? echo $name;?>+'"border=0></a> </td>')
//
write('<td width="'+menuwidth<? echo $name;?>+'px" valign="top">')
//
if (iedom<? echo $name;?>){
//
write('<div style="position:relative;width:'+menuwidth<? echo $name;?>+'px;height:'+menuheight<? echo $name;?>+'px;overflow:hidden;">')
//
write('<div id="test2<? echo $name;?>" style="position:absolute;left:0;top:0">')
//
write('</div></div>')
//
}
//
else if (document.layers){
//
write('<ilayer width='+menuwidth<? echo $name;?>+' height='+menuheight<? echo $name;?>+' name="ns_scrollmenu<? echo $name;?>">')
//
write('<layer name="ns_scrollmenu2<? echo $name;?>" left=0 top=0></layer></ilayer>')
//
}
//
write('</td>')
//
write('<td valign="middle"> <a href="#" '+rightdircode<? echo $name;?>+'>')
//
write('<img src="'+gorightimage<? echo $name;?>+'"border=0></a>')
//
write('</td></table>')
//
}
//
}

//
</script>
<?
}
?>

ddadmin
11-01-2008, 09:09 PM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Please post a link to the page on your site that contains the problematic script so we can check it out.

radu706
11-02-2008, 01:00 PM
http://www.dynamicdrive.com/dynamicindex1/scrollerlink.htm


my page is not online yet. I will put it on when is done.

wath I want to do is to repeat this menu for each value of array

radu706
11-03-2008, 02:27 PM
can enyone help me?

ddadmin
11-04-2008, 01:30 AM
You'll need to clarify the below:


wath I want to do is to repeat this menu for each value of array

Are you basically asking how to have more than 1 instance of "Scrollable Menu Links" on your page?

radu706
11-04-2008, 03:20 AM
yes :) and to work to :D

radu706
11-04-2008, 03:24 AM
here (http://cygnus.ro:99/tusiromania/foto/?path=L2V2ZW5pbWVudGUvaWFzaS9jZXZhX25vdS9pbmNhX3VuX2ZvbGRlcg==) is a link