Results 1 to 4 of 4

Thread: Having troubles with this code

  1. #1
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Having troubles with this code

    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!

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Bree
    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.

    Code:
    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.

    HTML Code:
    <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.

  3. #3
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Bree
    Hm well I still can't seem to get it to work
    Could you post a link to the page in question, then?

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •