I had fun with this one, hope it has everything you want on it.
Code:
<html>
<head>
<title>Custom Marquee - Demo</title>
</head>
<body text="#adadad" bgcolor="#0A0404">
<h3>Custom Marquee - Demo</h3>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img style="cursor:pointer; cursor:hand;" onclick="roll(this);" src="canister.jpg" alt="Film Canister" title="Click for Film Strip Gallery" height="131" width="69" border="0"></td>
<td>
<script type="text/javascript">
/*
Custom Cross browser Marquee script -
From script © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use,
Visit http://www.dynamicdrive.com
This credit MUST stay intact for use
Customization courtesy of and © John Davenport Scheuer
(jscheuer1 - Dynamic Drive Help Forums)
Visit http://www.dynamicdrive.com/forums/
*/
//Set Height Adjustment to center marquee vertically
var hgtAdj=3
//Specify the marquee's width (in pixels)
var marqueewidth="560px"
//Specify the marquee's height
var marqueeheight="131px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2
//configure background color:
var marqueebgcolor="#0A0404"
//configure canister's title (tooltip) after extension
var afterExt="Click to Retract Film"
//configure film's title (tooltip)
var negTit="Click Negatives for 'Print Quality' Images"
//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 id="trueContainer"><a href="balloon.jpg" target="_blank"><img src="4.jpg" alt="" height="131" width="113" border="0"></a><a href="darius.jpg" target="_blank"><img src="3.jpg" alt="" height="131" width="107" border="0"></a><a href="trike.jpg" target="_blank"><img src="2.jpg" alt="" height="131" width="107" border="0"></a><a href="portrait.jpg" target="_blank"><img src="1.jpg" alt="" height="131" width="107" border="0"></a><img src="0.jpg" alt="" height="131" width="119" border="0"></nobr>'
////NO NEED TO EDIT BELOW THIS LINE////////////
var copyspeed=marqueespeed
var direction='reverse'
var iedom=document.all||document.getElementById
var lefttime, actualwidth, cross_marquee, ns_marquee, canEl, bTit=''
function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.innerHTML=marqueecontent
actualwidth=document.all? trueContainer.offsetWidth : document.getElementById("trueContainer").offsetWidth
cross_marquee.style.left=8-actualwidth+"px"
}
var strip=document.images
for (var i = 0; i < strip.length; i++){
var test=strip[i]
while (test.parentNode){
if (test.parentNode&&test.parentNode.id=='trueContainer'){
strip[i].title=negTit
break
}
test=test.parentNode
}
}
//alert (document.images[2].parentNode.parentNode.id)
}
window.onload=populate
function altM(){
direction=(direction=='reverse')? 'forward' : 'reverse'
}
function roll(el){
canEl=el
if (bTit=='')
bTit=canEl.title
clearInterval(lefttime)
lefttime=setInterval("scrollmarquee()",20)
canEl.title=''
canEl.style.cursor='default'
}
function scrollmarquee(){
if (iedom){
var c1=(direction=='reverse')? (parseInt(cross_marquee.style.left)<-1) : (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8));
if (c1)
(direction=='reverse')? cross_marquee.style.left=parseInt(cross_marquee.style.left)+copyspeed+"px" : cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else{
clearInterval(lefttime)
canEl.title=(direction=='reverse')? afterExt : bTit
canEl.style.cursor=(document.all&&!window.opera)? 'hand' : 'pointer'
altM();
return;
}
}
else
return;
}
if (iedom){
with (document){
write('<table border="0" cellspacing="0" cellpadding="0"><td>')
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:'+hgtAdj+'px"></div>')
write('</div></div>')
write('</td></table>')
}
}
</script>
</td>
</tr>
</table>
</body>
</html>
Bookmarks