Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Staffordshire
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Putting a background img into an error box?!

    Well, this is my first post here, and it is kind off an embassing prob. so here goes. I'm just wondering how you would put an image into the custom javascript error box in the following code (taken from Javascript kit). - Is it possible??

    <script>

    /*
    Custom javascript error box
    By JavaScript Kit (http://javascriptkit.com)
    Over 200+ free scripts here!
    */

    function errorbox(){
    errorwindow=window.open("","","width=250,height=125")
    errorwindow.document.write('<title>Error Window</title><center><b>A JavaScript error(s) has occurred on this page</b><Br><form><input type="button" value="Close window" onClick="window.close()"></form></center>')
    errorwindow.document.close()
    errorwindow.document.bgColor="white"
    return true
    }
    window.onerror=errorbox
    </script>

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    you can use css with a style sheet or just hard code it to the body tag

    basic idea

    <body style="background-image:url('thepic.gif')">

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Feb 2004
    Location
    Staffordshire
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've tried but still doesn't seem to want to work. What if i changed the code where its says

    errorwindow.document.bgColor="white"

    ? to

    errorwindow.document.background-img src="url.gif"

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    hardcode the url to the exact place where it is located (don't do relative) and see if that helps
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Follow KISS principle and use the standard alert().
    Your "custom" window will be missed by all the people who have popup blocking enabled.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #6
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    and what you were saying before

    errorwindow.document.body.style.backgroundImage = 'url(filepath/imagefile.jpg)'
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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