Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pretty User Error Alert Box

Status
Not open for further replies.

Deltaflyer

Programmer
Oct 11, 2000
184
0
0
GB
I would like to respond to my users errors with something more than a drab grey windows lookalikey error box. I have seen pages that the text in an alert-style box is coloured.

Can you tell me if this coding would work to give me a


-------------------------------------
The date you entered is invalid
-------------------------------------
style message box.

var text1 = "The ";
var text2 = "date ";
var text3 = "you entered is invalid. ";
text2 = text2.fontcolor(“red”);
alert(text1+text2+text3)
DeltaFlyer - The Only Programmer To Crash With Style.
 
you'll need to open a new window with
window.open()

then you can customize the look of the window using standard html tags or css

nick bulka

 
I dont think that will work. I do, however, have a (terrible) script I wrote some time ago that emulates alert and confirm boxes pretty well (im lying)... either way go look at it and if you like them i will explain how to use it...ONLY works in IE5+ (maybe 4 but not tested)

jared@aauser.com
 
Jared,
please explain why you think it won't work.

nick bulka

 
that message was written simultaneously to yours,(I didnt see yours before I posted mine)... I meant using fontcolor to set an alert box won't work... jared@aauser.com
 
Please explain your emulated alert boxes. Thanx
 
ok they are quite easy to use...I wish I made them differently now, because theres a lot of stuff I just cant (wont) take the time to fix... anyways if you want I will have to email you the file... you basically include an HTML file in your file, which containts the HTML for the dialog boxes and the code... you call an init() function onload and when you wish to call a box, the syntax is as follows:

showMsgBox('boxtyp','title','message',functocall)

right now I only support a confirm box and an alert box, but new and custom types can be added just by changing the mainfunction a little... note that these boxes are not modal boxes and therefore do not actually stop the thread of script execution on the page... that is why you must supply a function argument to tell the box what to do when its ok button is called... I do not consider these to be good enough for any serious development... they do not preserve the look and feel of a normal box (ie they cannot be taken out of the browser window, can be dragged under frames, etc)...plus, you need to use my terrible drag and drop api to make use of the boxes... jared@aauser.com
 
Please email it to me at venijn@programmer.net Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top