PDA

View Full Version : Pausing up-down message scroller



hair
03-13-2005, 03:09 AM
once I added the script, I can view the first 2 messages of 5. After that the word undefined shows up. I double checked to make sure there are no spaces etc... but still it is showing the word undefined. Everything else including the scrollerwidth and height is perfect. Hope you help me, thx in advance

here's a link to view what I mean

http://www.geocities.com/hairdowntohere/testBat.index.html

jscheuer1
03-13-2005, 05:42 AM
I just downloaded your page. After I removed the scripts added by the server, everything worked fine. By process of elimination, it is this geocities script that is the problem:

<script language="JavaScript" src="http://us.i1.yimg.com/us.yimg.com/i/mc/mc.js">

near the bottom of the page. That script uses the variable 'i' as does your script. I changed 'i' to 'j' in your script and it helped some. Unfortunately, the above mentioned geocities script also calls in two other scripts. One of which uses 'j' as a variable. To make a long story short, replace your script with this one:


<SCRIPT type=text/javascript>

/***********************************************
* Pausing updown message scroller- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//configure the below five variables to change the style of the scroller
var scrollerdelay='3000' //delay between msg scrolls. 3000=3 seconds.
var scrollerwidth='350px'
var scrollerheight='165px'
var scrollerbgcolor='#4D4D4D'
//set below to '' if you don't wish to use a background image
var scrollerbackground=''

//configure the below variable to change the contents of the scroller
var messages=new Array()
messages[0]="<center><b>Welcome to the Batscave</b></center>"
messages[1]="Our rooms are friendly and outgoing, if you are a minor please let the other chatters know, on occasion there will be Adult content"
messages[2]="Register your name, be sure to let us know if you would like a log in gif as well"
messages[3]="Our chatrooms are Moderated with a live Admins, if you should encounter any problems, let them know or Email me "
messages[4]="We're here to have fun, so log in and meet the friendly people of the Batscave"

///////Do not edit pass this line///////////////////////

var ie=document.all
var dom=document.getElementById

if (messages.length>4)
xdt=2
else
xdt=0

function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout("move1(tlayer)",scrollerdelay)
setTimeout("move2(document.main.document.second)",scrollerdelay)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(messages[xdt])
tlayer.document.close()
if (xdt==messages.length-1)
xdt=0
else
xdt++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",scrollerdelay)
setTimeout("move1(document.main.document.first)",scrollerdelay)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(messages[xdt])
tlayer2.document.close()
if (xdt==messages.length-1)
xdt=0
else
xdt++
}
}

function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+"px"
setTimeout("move3(tdiv)",scrollerdelay)
setTimeout("move4(second2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=parseInt(scrollerheight)
tdiv.innerHTML=messages[xdt]
if (xdt==messages.length-1)
xdt=0
else
xdt++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
setTimeout("move4(tdiv2)",scrollerdelay)
setTimeout("move3(first2_obj)",scrollerdelay)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=parseInt(scrollerheight)
tdiv2.innerHTML=messages[xdt]
if (xdt==messages.length-1)
xdt=0
else
xdt++
}
}

function startscroll(){
if (ie||dom){
first2_obj=ie? first2 : document.getElementById("first2")
second2_obj=ie? second2 : document.getElementById("second2")
move3(first2_obj)
second2_obj.style.top=scrollerheight
second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}

window.onload=startscroll

</SCRIPT>

and it should work, all 'i' variables replaced by 'xdt'

hair
03-13-2005, 09:37 PM
much appreciated, take care J =o)