PDA

View Full Version : Translucent Scroller centered



Aggiemom08
07-08-2006, 08:02 PM
1) Script Title: Translucent Scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/translucentscroll.htm

3) Describe problem:

I love the scroller for presenting announcements and important dates on the webiste I'm working on, but I want the scroller box centered horizontally on the web page. I'm a newbie and don't know programming language, so I don't know what to add and where to enter it in the script. I hope someone can help. Thanks.

ddadmin
07-09-2006, 08:27 AM
Find the line:


document.write('<div style="position:relative;width:'+scroller_width+';height:'+scroller_height+';overflow:hidden;">

and add to it the code in red:


document.write('<div style="position:relative;width:'+scroller_width+';height:'+scroller_height+';overflow:hidden;margin-left: 42%">

Now, I'm sort of cheating, and this isn't perfectly centered, just a rough estimate. :)

Aggiemom08
07-10-2006, 03:05 AM
I added the text in red, but when I try to preview the page I get an error message that says "unterminated string constant"

I would have you look at the website, but I'm working offline until I get theis part figured out. The entire line, plus the part in red you supplied, reads:

if (ie4||dom)
document.write('<div style="position:relative;width:'+scroller_width+';height:'+scroller_height+';overflow:hidden;[COLOR="Red"]margin-left: 42%"><div id="canvas0" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div><div id="canvas1" style="position:absolute;background-color:'+bgcolor+';width:'+scroller_width+';height:'+scroller_height+';top:'+scroller_height+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div></div>')
else if (document.layers){
document.write('<ilayer id=tickernsmain visibility=hide width='+scroller_width+' height='+scroller_height+' bgColor='+bgcolor+'><layer id=tickernssub width='+scroller_width+' height='+scroller_height+' left=0 top=0>'+scrollercontent[0]+'</layer></ilayer>')
}

I'm not sure wheat an unterminated string constant is, but I'm assuming the line should have ( ) at the beginning and end, which it does. Can you explain what that error is? Thanks.

ddadmin
07-10-2006, 06:55 PM
The code ;[color="Red"] within the above should not be there. In other words, the only addition to the original code that should be added is:

margin-left: 42%

at the very end.

Aggiemom08
07-11-2006, 02:14 AM
That did the trick! Thanks so much.