I found this free javascript here at http://www.bobbyware.com/jfloat.shtml that I would like to use on my site but it won't work with my DOCTYPE. Would anyone here be able to take a look at this script http://www.torgo.org/media/scripts/jfloat.js and make it compatable with this DOCTYPE "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"? I did some research and was able to get it to work in Internet Exporer by changing .body. to .documentElement. but it's still won't work in Firefox. Any javascript Guru suggestions would be greatly appreciated!
i don't even know where to begin here, there is just so much wrong with this script that its not worth using, bascially. xhtml 1 needs all tags to be in lowercase. this script prints uppercase: <SCRIPT LANGUAGE="JavaScript" SRC="jfloat.js"></SCRIPT> ... document.write('<DIV ID="float_pane" STYLE="position:absolute;visibility:hidden">\n'); if( link != "" ) document.write('<A HREF="' + link + '">'); document.write('<IMG SRC="' + image + '" BORDER="0">'); if( link != "" ) document.write('</A>'); document.write('\n</DIV>'); PHP: now, this on its own is not sufficient to break it. but the way it queries the browser agent and only understands what it thinks their capabilities are (were in 2003/4 when they wrote this) is totally not practical. for instance, it tries to reference elements in firefox not via dom (but it does for netscape and all other browsers also support document.getElementById anyway)... it runs every 5 ms, polling and using up resources when all it needs to do is run on scroll and lay dormant otherwise... since then there's element.style.position = 'fixed'; (which does exactly this except for w/o javascript - all you need to do is code this to absolute and set pos on ie6). http://www.w3schools.com/Css/pr_class_position.asp - needs strict doctype for IE7 though. seriously, get rid of this and get something that's 2007/8/9... here's an example of what is possible these days, for instance, notimoo: http://paquitosoft.com/notimoo/
Thank you for the reply Dimitar, it is much appreciated. I took your advice and stopped messing with that floating image javascript and am now using the css code you recommended. I had no idea you could do that with css and it even looks better in a fixed position. Thanks again for taking the time to help me.