PDA

View Full Version : Cross Browser marquees disables rollover images in page



MarioGian
12-23-2007, 04:30 AM
1) Script Title: cross browser

2) Script URL (on DD): <script language="JavaScript1.2">

/*
Cross browser Marquee script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
Credit MUST stay intact
*/

//Specify the marquee's width (in pixels)
var marqueewidth="300px"
//Specify the marquee's height
var marqueeheight="25px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2
//configure background color:
var marqueebgcolor="#DEFDD9"
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1

//Specify the marquee's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):

var marqueecontent='<nobr><font face="Arial">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> If you find this script useful, please consider linking to us by <a href="../link.htm">click here.</a> Enjoy your stay!</font></nobr>'


////NO NEED TO EDIT BELOW THIS LINE////////////
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
var actualwidth=''
var cross_marquee, ns_marquee

function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
cross_marquee.innerHTML=marqueecontent
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.left=parseInt(marqueewidth)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualwidth=ns_marquee.document.width
}
lefttime=setInterval("scrollmarquee()",20)
}
window.onload=populate

function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"

}
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed
else
ns_marquee.left=parseInt(marqueewidth)+8
}
}

if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>

3) Describe problem: Scroller text works fine, but when I insert it into any page of my html site, any rollover effects or dynamic effects cease to work in that page

djr33
12-23-2007, 05:36 AM
I'm guessing that the onload event is conflicting in both scripts. If you could link to your page that could be confirmed.

This script certainly doesn't just arbitrarily disable those, and it's probably mutual, whichever is called first then doesn't allow the other to work.

MarioGian
12-25-2007, 10:17 PM
Thanks for your reply. Here is the code you wanted to see about the onload line
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title> AMB_Autos2 &raquo; Page 1 of 2 </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css;" />
<link rel="stylesheet" href="amb_autos2_g.css" type="text/css" media="screen,projection,print" /> <!--// Document Style //-->
<link rel="stylesheet" href="index_p.css" type="text/css" media="screen,projection,print" /> <!--// Page Style //-->
<script src="amb_autos2_g.js" type="text/javascript"></script> <!--// Document Script //-->
<script src="index_a.js" type="text/javascript"></script> <!--// Motion Script //-->
</head>


<body onload="if(IE||V5) OnWeLoad()">
<div id="page">
<a href="index.html">
<img id="e9" name="e9" src="amb_autos2001010.gif" title="" alt="amb_autos2001010.gif" align="right" border="0" /></a>
<span id="e8" class="cc01"></span>
<a href="amb_autos2_002.htm" onmouseover="OnWeOver(0,0,0,IDP[3],Img7,'amb_autos2_002.htm',1)" onmouseout="OnWeOver(0,0,0,IDP[3],Img7,0,0)">
<img id="e7" name="e7" src="amb_autos2001007.gif" title="" alt="amb_autos2001007.gif" align="right" border="0" /></a>
<a href="http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?ViewItem&ih=014&sspagename=STRK%3AMESE%3AIT&viewitem=&item=330192587730&rd=1" onmouseover="OnWeOver(0,0,0,IDP[2],Img6,'http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?ViewItem&ih=014&sspagename=STRK%3AMESE%3AIT&viewitem=&item=330192587730&rd=1',1)" onmouseout="OnWeOver(0,0,0,IDP[2],Img6,0,0)" target="_blank">
<img id="e6" name="e6" src="amb_autos2001005.gif" title="" alt="amb_autos2001005.gif" align="right" border="0" /></a>
<a href="#" onmouseover="OnWeOver(0,0,0,IDP[1],Img5,0,1)" onmouseout="OnWeOver(0,0,0,IDP[1],Img5,0,0)">
<img id="e5" name="e5" src="amb_autos2001003.gif" title="" alt="amb_autos2001003.gif" align="right" border="0" /></a>
<div id="e4" class="cc02">
AMB AUTOS LLC 1221S. Dixie Hwy. Pompano Beach, FL 33060 954-943-4221 Fax: 954-788-0370
</div>
<a href="amb_autos2_002.htm">
<img id="e3" name="e3" src="amb_autos2001002.jpg" title="" alt="amb_autos2001002.jpg" align="right" border="0" /></a>
<div id="e2">
<script language="JavaScript1.2">

/*
Cross browser Marquee script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
Credit MUST stay intact
*/

//Specify the marquee's width (in pixels)
var marqueewidth="739px"
//Specify the marquee's height
var marqueeheight="27px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2
//configure background color:
var marqueebgcolor="#000000"
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1

//Specify the marquee's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):

var marqueecontent='<nobr><font face="Verdana"><font size="3"><font color="ffffff"><strong>Sales & Service, Maintenance & Repair, End of Lease Inspection, Wheels, Tires</strong></font></nobr>'


////NO NEED TO EDIT BELOW THIS LINE////////////
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
var actualwidth=''
var cross_marquee, ns_marquee


function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
cross_marquee.innerHTML=marqueecontent
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.left=parseInt(marqueewidth)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()

actualwidth=ns_marquee.document.width
}
lefttime=setInterval("scrollmarquee()",20)
}
window.onload=populate

function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"

}
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed
else
ns_marquee.left=parseInt(marqueewidth)+8

}
}

if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}

</script>
</div>
<span id="e1"></span>
</div>
</body>
</html>

Hope this is what you wanted to look at.