PDA

View Full Version : JavaScript conflict, please help !!!


andilcho
02-06-2003, 10:34 PM
I have 2 scripts. The first one is a vertical message scroller and the second one is a clock. The vertical message scroller was working fine until I added the clock. The clock began working but the vertical message scroller stopped running. Can anyone help please? Below you will find both scripts in one document.

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<style type="text/css">

A:link {color:blue;}

A:visited{color: purple;}

A:hover {color: red;}

.taj { font-weight:bold; font-size:12px; text-align:justify; font-family:Arial;}

.tab { font-size:12px; font-family:Arial;color:white;}

.tacb { font-weight:bold; font-size:14px; font-family:Arial;color:white;}

.tabc { font-weight:bold; font-size:14px; text-align:justify; font-family:Arial;}

.tabb { font-weight:bold; font-size:18px; font-family:Arial;}

.tabt { font-weight:bold; font-size:18px; font-family:Arial;color:white;}

</style>

<script language="JavaScript">

var swidth=155

var sheight=100

var sbcolor="#003366"

var sspeed=2

var resumesspeed=sspeed

var wholemessage=''

srcpng1 = new Image();

srcpng1.src = "http://seductivesoundsdjs.com.gif";

wholemessage='<div align="center" class=tacb>Welcome !</DIV>'+

'<div align="center" class=tab><b>This is</b></DIV>'+

'<div align="center" class=tab><b>seductivesoundsdjs.com</b></DIV>'+

'<div align="center" class=tab><b>"Music for your partying and dancing pleasure"</b></DIV>'+

'<div align="center" class=tab><BR>1.CLICK on HyperLink Image:</div>'+

'<div align="center" class=tab><a class=tabb href="#" onClick=\'window.top.location.href="http://www.seductivesoundsdjs.com"\'><img width="150" height="56" src=' +srcpng1.src+ '></a></div>'+

'<div align="center" class=tab><b>"Music for any occasion"</b></div>'+

'<div align="center" class=tab><BR><b><i>We are here for you</i></b><div>'+

'<div align="center" class=tab><a class=tab href="http://www.seductivesoundsdjs.com" onClick=\'window.top.location.href="http://www.seductivesoundsdjs.com">Music for your partying and dancing pleasure</a></div>'

function start(){

if (document.all) iemarquee(slider);

else if (document.getElementById)

ns6marquee(document.getElementById('slider'));

else if(document.layers)

ns4marquee(document.slider1.document.slider2);

}

function iemarquee(whichdiv){

iediv=eval(whichdiv)

iediv.innerHTML=wholemessage

iediv.style.pixelTop=sheight

sizeup=iediv.offsetHeight

ieslide()

}

function ieslide(){

if (iediv.style.pixelTop>=sizeup*(-1)){

iediv.style.pixelTop-=sspeed

setTimeout("ieslide()",100)

}

else{

iediv.style.pixelTop=sheight

ieslide()

}

}

function ns4marquee(whichlayer){

ns4layer=eval(whichlayer)

ns4layer.document.write(wholemessage)

ns4layer.document.close()

sizeup=ns4layer.document.height

ns4layer.top-=sizeup

ns4slide()

}

function ns4slide(){

if (ns4layer.top>=sizeup*(-1)){

ns4layer.top-=sspeed

setTimeout("ns4slide()",100)

}

else{

ns4layer.top=sheight

ns4slide()

}

}

function ns6marquee(whichdiv){

ns6div=eval(whichdiv)

ns6div.innerHTML=wholemessage

ns6div.style.top=sheight

sizeup=ns6div.offsetHeight

ns6slide()

}

function ns6slide(){

if (parseInt(ns6div.style.top)>=sizeup*(-1)){

ns6div.style.top=parseInt(ns6div.style.top)-sspeed

setTimeout("ns6slide()",100)

}

else{

ns6div.style.top=sheight

ns6slide()

}

}

</script>

</head>

<body marginwidth="0" marginheight="0" onload="start()" topmargin="0" leftmargin="0" bgcolor="#ffffff"><br><br>
<ilayer width="&amp;{swidth};" height="&amp;{sheight};"
name="slider1" bgcolor="&amp;{sbcolor};">


<layer name="slider2" width="&amp;{swidth};"
onmouseover="sspeed=0;" onmouseout="sspeed=resumesspeed">
</layer>
</ilayer>


<script language="JavaScript">

if (document.getElementById || document.all){

document.write('<div style="position:relative;overflow:hidden;width:'+swidth+';height:'+sheight+';clip:rect(0 '+swidth+' '+sheight+' 0);background-color:'+sbcolor+';" onMouseover="sspeed=0;" onMouseout="sspeed=resumesspeed">')

document.write('<div id="slider" style="position:relative;width:'+swidth+';">')

document.write('</div></div>')

}

</script>




<!Here is the clock below>





<div align="center">
<font face="Arial, Helvetica, Sans Serif" size="2" color="#0000FF"><b>
<span id="clock">

<Script Language="JAVASCRIPT">
<!-- Begin
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
d = new Date();
Time24H = new Date();
Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
if (InternetTime < 10) InternetTime = '00'+InternetTime;
else if (InternetTime < 100) InternetTime = '0'+InternetTime;
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate=dayarray[day]+", "+montharray[month]+" "+daym+" "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+" | @"+InternetTime+""
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
window.onload=goforit
// End -->
</script>

</span>
</b>
</font>
</div>


</body>

</html>

Graeme Hackston
02-06-2003, 10:55 PM
Try removing this:

window.onload=goforit

And replacing this:

onload="start()"

with this:

onload="start();goforit()"

andilcho
02-07-2003, 03:40 PM
Thank you Graeme.

you did it !!!!

It's working perfectly !!!:thumbsup: