View Full Version : floating advertise (banner) problem

03-16-2005, 04:20 PM
i have a javascript which allows me to put a floating advartize
in HTML pages, so if the user scrolls the page down the banner goes down with the page
so it's in sight all the time (until the user clicks to close it).

you can see the example of a working banner here:

when i put the code in a HTML page that includes this line at the top of it:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

the banner is not floating anymore, and it stays in the bottom of the page.

you can see a version of the bad banner here:

by removing this line I solve the problem.
by removing the absolute link to the file:
that is in the line, I also solve the problem.

Unfortunatlly, both are imposibole solutions, because I cant force
websites that publish my ads to remove this line or part of it (which could also be a rough job when PHP invloved)..
This line is added my some PHP alpications.

What could be the solution in the JS code so there won't be a conflict between my floating banner JS and the
xhtml1-transitional.dtd file loaded to the page ?

thank you for helping.

03-17-2005, 09:44 AM
I think the easiest way would be to make a floating div, with normal HTML and CSS, that does the desired float.

Then you can use javascript to fill the box as desired. The close effect would then be achieved by a simple "document.getElementById('the_box').style.display='none';"

If i have a quick look at your page i see you use a table. Some browsers have been reported (especially some versions of IE, for a change!) to handle fixed tables. Fixing div's seems to be much better supported.

03-17-2005, 01:55 PM
thank you for your answer,

can you please tell me how exactlly can i do it ?
a small example would be most appriciated.

thank you.