PDA

View Full Version : Need Help with 2 scripts



ormsbee
05-03-2005, 03:56 AM
I am using the following two scripts on one web site:


Conveyor belt slideshow script

Jim's DHTML Menu v5.7
The menu works great on all pages except for the two pages where I have images displayed using the conveyor belt slideshow script. The menu just does not appear. Am I doing something wrong? Does anyone know if there is a conflict with the two scripts? If not, what I am doing wrong. Could someone please help? I am desperate.

Thanks.

Brian

jscheuer1
05-03-2005, 04:12 AM
.

Anyways, one thing not covered in the material referred to above is the idea of putting the slideshow in an iframe. That may or may not work with your layout but, it will eliminate script conflicts. If you -

.

It would be easier to advise.

ormsbee
05-03-2005, 03:24 PM
Hi John, thanks for the reply. I went throught the tutorial and in fact, I do have two competing scripts: <body onload="init()> (for the menu) and window.onload=fillup (for the scrolling image filmstrip). I tried to combine them as <body onload="dothis(init());dothat(fillup)">. But that did not work. What is the appropriate syntax and is there a specific location this needs to be inserted or can it go at the beginnig of the body?

Thanks for your help.

jscheuer1
05-03-2005, 04:37 PM
<body onload="init();fillup()">

Goes right in the body tag and remove this line from its script:


window.onload=fillup

ormsbee
05-03-2005, 04:59 PM
John, Thank you so very much. It worked like a charm. Learning something new every day.

Have a good one.

Brian

bernd
04-15-2006, 02:00 PM
Hello,

I'm having the same problems like many others with these scripts. The problem
is that the HV menu doesen't appear when the belt script is in the same page.
Could you help to run these scripts together...?
I tried to understand the explanations an tutorials... but I'm not so familiar with javascript programming.
Regards

Bernd


Here ist the Source Code:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Willkommen bei den Kandfrauen Bötzingen</title>

<script language="javascript">
var laufschrift = "Relaunch Landfrauen Website +++ Vielen Dank an S.G für die Bereitstellung seines Bienenbildes +++ ";
var start = 0;
var stop = laufschrift.length;

function lauftext() {
document.ticker.ticker.value = "" + laufschrift.substring(start,stop) + " " + laufschrift.substring(0,start);
start++;
if(start >= stop) { start = 0; }
setTimeout("lauftext()", 120);
}

</script>
<script language="javascript" type="text/javascript">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,re sizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
<link href="format.css" rel="stylesheet"
type="text/css">
</head>

<body bgcolor="#FFF0F5" onload="lauftext()">
<form name="ticker">
<script type='text/javascript'>

//HV Menu- by Ger Versluis (http://www.burmees.nl/)
//Submitted to Dynamic Drive (http://www.dynamicdrive.com)
//Visit http://www.dynamicdrive.com for this script and more

function Go(){return}

</script>
<script type='text/javascript' src='scripts/exmplmenu_var.js'></script>
<script type='text/javascript' src='scripts/menu_com.js'></script>


<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><img src="images/krokus1.jpg" alt="" height="237" width="315" border="0"></td>
<td><div id='MenuPos' style='position:relative; width:145; height:237;'></div></td>
<td><img src="images/logo1.jpg" alt="" height="237" width="300" border="0"></td>
</tr>
<tr>
<td><img src="images/gallerie.jpg" alt="" height="36" width="315" border="0"></td>
<td colspan="2"><input type="text" name="ticker" style="border: none; padding: 10px 2px 2px 2px; background-image:url(images/ueber2.jpg); color: #F5D6F6; width: 445px;height: 36px"></td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center">

<script language="JavaScript1.2">

/*
Conveyor belt slideshow script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com
*/


//Specify the slider's width (in pixels)
var sliderwidth="280px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=2
//configure background color:
slidebgcolor="#ffffff"

//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="slides/fisch1a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch1.jpg" border=1></a>'
leftrightslide[1]='<a href="slides/fisch2a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch2.jpg" border=1></a>'
leftrightslide[2]='<a href="slides/fisch3a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch3.jpg" border=1></a>'
leftrightslide[3]='<a href="slides/fisch4a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch4.jpg" border=1></a>'
leftrightslide[4]='<a href="slides/fisch5a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch5.jpg" border=1></a>'
leftrightslide[5]='<a href="slides/fisch6a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch6.jpg" border=1></a>'
leftrightslide[6]='<a href="slides/fisch7a.jpg" onclick="NewWindow(this.href,\'mywin\',\'420\',\'320\',\'no\',\'center\');return false" onfocus="this.blur()"><img src="slides/fisch7.jpg" border=1></a>'
////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(" ")+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide

function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+20+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+20
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup

function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+30+"px"

if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+30+"px"

}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+30

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+30
}
}


if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script><p><p>
---code was shortend

jscheuer1
04-15-2006, 03:34 PM
Because HV Menu is such a complicated script and its onload event(s) are not easily identified and may change across browsers, I would try this approach - forget about modifying HV and instead try to make conveyor 'play nice'. This can be tried by substituting:


if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", fillup, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", fillup );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
fillup();
};
}
else
window.onload = fillup;
}

for:


window.onload=fillup

in the conveyor script.