...

View Full Version : Putting a background img into an error box?!



odin22
02-05-2004, 04:20 PM
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>
:confused:

A1ien51
02-05-2004, 04:28 PM
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

odin22
02-05-2004, 04:36 PM
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"

A1ien51
02-05-2004, 04:42 PM
hardcode the url to the exact place where it is located (don't do relative) and see if that helps

Vladdy
02-05-2004, 04:43 PM
Follow KISS principle and use the standard alert().
Your "custom" window will be missed by all the people who have popup blocking enabled.

A1ien51
02-05-2004, 04:44 PM
and what you were saying before

errorwindow.document.body.style.backgroundImage = 'url(filepath/imagefile.jpg)'



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum