PDA

View Full Version : Having troubles with this code



Bree
04-02-2005, 09:55 PM
I'm trying to put on a watermark background and can't seem to get it to work. Here is my code...
<script language="JavaScript1.2">

/*
Watermark Backgound Image Script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS,
visit dynamicdrive.com
*/

if (document.all||document.getElementById)
document.body.style.background="url(http://tinypic.com/2jz8e0') white center no-repeat fixed"

</script>

I've tried this without the () around the link, without the letters URL, tons of things but can't figure it out! Can anyone help me?
Thanks!

mwinter
04-02-2005, 10:20 PM
I'm trying to put on a watermark background and can't seem to get it to work. Here is my code...This shouldn't be a script. It should be declaration in a style sheet[1]. If you have a style sheet in your document already, merge the following with that.


body {
background: url(http://tinypic.com/2jz8e0) white center no-repeat fixed;
}If you don't have a style sheet, wrap the above with the following mark-up and place it inside the head element.


<style type="text/css">
/* Place rule here. */
</style>If you look closely, you'll notice that I removed a single quote. That was what was causing the problem. The functional notation - url(...) - is essential for specifying remote images and removing that would certainly not help.

By the way, I hope you aren't intending to serve a bitmap over the Internet. A JPEG would cut the file size to a tenth of the current ~100KB.

Mike


[1] For all intents and purposes, it is. It produces exactly the same result, only with the unnecessary reliance upon scripting.

Bree
04-03-2005, 06:47 PM
Hm well I still can't seem to get it to work but I appreciate you taking the time. And thanks for the tip about saving as a JPEG, I went and changed the pictures that weren't saved that way.

mwinter
04-04-2005, 03:23 PM
Hm well I still can't seem to get it to workCould you post a link to the page in question, then?

Mike