...

View Full Version : JS Horizontal Scrolling text not working



allee100
05-05-2004, 11:35 PM
I have a horizontal scrolling bar on a web page that stopped working. It works fine when I take it off of the page and put it by itself on a sepperate HTML page, but when I added a Flash banner below it the text stopped scrolling. I think that some other JS may be interferring, but not sure, any thoughts?

This is the JS code in the head:

<SCRIPT LANGUAGE="JavaScript">

//-- Begin Scroller's Parameters -->

//scroller width: change to your own;
var wwidth=400


//scroller height: change to your own;
var wheight=20

//background color: change to your own;
var wbcolor="#ffffff"

//scroller's speed: change to your own;
var wspeed=3

var wwholemessage=''

//text: change to your own

wwholemessage='<nobr class=Cell2>Fill with content here and links to that content that gives more detail:<a class=cLink2 href="#" onClick=\'window.top.location.href="http://www.360vinyl.com"\'><u>allee</u></a></nobr>';

//-- end Parameters-->
var resumewspeed=wspeed
var sizeupw=0;
function startw(){
if (document.all) iemarqueew(wslider);
else if (document.getElementById)
ns6marqueew(document.getElementById('wslider'));
else if(document.layers)
ns4marqueew(document.wslider1.document.wslider2);
}
function iemarqueew(whichdiv){
iedivw=eval(whichdiv)
iedivw.style.pixelLeft=wwidth
iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>'
sizeupw=iedivw.offsetWidth
ieslidew()
}
function ieslidew(){
if (iedivw.style.pixelLeft>=sizeupw*(-1)){
iedivw.style.pixelLeft-=wspeed
setTimeout("ieslidew()",50)
}
else{
iedivw.style.pixelLeft=wwidth
ieslidew()
}
}
function ns4marqueew(whichlayer){
ns4layerw=eval(whichlayer)
ns4layerw.left=wwidth
ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>')
ns4layerw.document.close()
sizeupw=ns4layerw.document.width
ns4slidew()
}
function ns4slidew(){
if (ns4layerw.left>=sizeupw*(-1)){
ns4layerw.left-=wspeed
setTimeout("ns4slidew()",50)
}
else{
ns4layerw.left=wwidth
ns4slidew()
}
}
function ns6marqueew(whichdiv){
ns6divw=eval(whichdiv)
ns6divw.style.left=wwidth
ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>'
sizeupw=ns6divw.offsetWidth
ns6slidew()
}
function ns6slidew(){
if (parseInt(ns6divw.style.left)>=sizeupw*(-1)){
ns6divw.style.left=parseInt(ns6divw.style.left)-wspeed
setTimeout("ns6slidew()",50)
}
else{
ns6divw.style.left=wwidth
ns6slidew()
}
}

//-- end Algorithm -->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>

and this is calling the function in the body:

"><!-- begin: body code -->
<script language="JavaScript">
if (document.getElementById || document.all){
document.write('<div style= "position:relative;overflow:hidden;width:'+wwidth+';height:'+wheight+';clip:rect(0 '+wwidth+' '+wheight+' 0);background-color:'+wbcolor+';"onMouseover="wspeed= 0;"onMouseout="wspeed=resumewspeed">')
document.write('<div id="wslider" style="position:relative;width:'+wwidth+';height:'+wheight+';">')
document.write('</div></div>')
}
</script> <ILAYER width="&amp;{wwidth};" height="&amp;{wheight};" name="wslider1" bgcolor="&amp;{wbcolor};"
>
<LAYER name="wslider2" width="&amp;{wwidth};" height="&amp;{wheight};" onMouseover="wspeed=0;" onMouseout="wspeed=resumewspeed">
</LAYER>
</ILAYER><!-- end -->

DHTML Kitchen
05-06-2004, 03:15 PM
What do you think is the problem?

Why did you decide to use an ilayer?

Using a time-based animation and varying the number of frames will allow you to have a scroller that scrolls at the same speed in any browser. It will never be too fast or too slow, though slower browsers will be less smooth, having fewer frames. This of course assumes that we're talking about a scroller that actually works ;)

allee100
05-06-2004, 05:45 PM
I'm not sure what the problem is, that is whay I posted a question.

How do I put together a time-based animation? Dose anyone have any other suggestions that I can use with the code that I have right now?

allee100
05-08-2004, 03:12 AM
I'm still wondering about this question, does anyone have a suggestion? If you need the whole HTML file I can email that to you. I don't think this is a hard thing to figure out, but I am deffinately not a JS expert. Anything you can suggest would be very helpful.

Thanks
Allee

swmr
05-08-2004, 03:59 AM
In general, most things are difficult to figure out for the first time, and subsequently become less complicated.

Beginning with the basics, and reassessing them often, may eventually lead one to a grasp of independent concepts--which must first be understood, before their interplay should be attempted.

So, the question: "How do I put together a time-based animation?" is not a simple one, and has not just one answer -- you'd need to incorporate several methods, and test them in more than one browser, etc.

-- that's probably not what you wanted to hear, but is all I can offer at the moment. ;)

allee100
05-10-2004, 10:28 PM
I think this discussion got a little off track. My original question is looking for a specific answer and that has been over looked. "I have a horizontal scrolling bar on a web page that stopped working. It works fine when I take it off of the page and put it by itself on a separate HTML page, but when I added a Flash banner below it the text stopped scrolling. I think that some other JS may be interfering, but not sure, any thoughts?"

The problem that I am looking for an answer to is that the scrolling text or ticker text works fine when alone on a page, but not when more elements are added. I think the problem is that other JS functions are interfering somewhere and I am hoping that someone can take a look at the above code and find any errors. As it is I can not seem to find the error.

Roy Sinclair
05-10-2004, 10:55 PM
Does it work in Netscape 4 but not in IE or not at all in either browser? (It obviously won't work in any Gecko based browser like Netscape 6 or later, it's not using the right code for that).

Can you post a link to the broken page?

(You're right in sticking to your guns and reiterating the original question).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum