slayeroffice - web experiments gone horribly awry

02.02.2005 - Custom Alert

The bulk of the description of this latest experiment and whence it came can be found on it's demonstration page, so I'll not go into detail here, though I will quote its caveat:

This is a demonstration only. I am not saying that this is a production worthy alternative to the default behavior of the window.alert method as it does not allow for true modality. I am only showing what is possible - implement at your own risk. Feel free to contact me with any suggestions. that the CYA is out of the way, check out how to over-ride the default behavior of the window.alert method.

Tested and works in MSIE6, Firefox 1.0, Opera 7.2+ and Safari. Browsers who fall into the !document.getElementById camp get the normal stuff.

What would really be neat is if someone packaged this in an extension for Firefox as a creative solution to Bug 59314 (Alerts should be content-modal, not window-modal).
Posted by Justin on February 3, 2005 @ 2:22 am
Its a pretty nice experiment you got there.

Here is a little addition ... replace with <br/>
Posted by Martin Hintzmann Andersen on February 3, 2005 @ 8:21 am

The comment system removed my backslash n ( n )
Posted by Martin Hintzmann Andersen on February 3, 2005 @ 8:24 am
The line return occured to me when writing this, but I couldnt decided if it was a better option to replace the paragraph element with a pre element so that the slash n would work, or if I should parse the text argument and create a new paragraph element when I encounter one.

The pre would be easier, of course...I'll have to think on it.
Posted by Steve on February 3, 2005 @ 1:31 pm

It would be nice if this alert DIV could be draged, to emulate window moving, in case it hides something important in the window content.

Regarding IE scroll problem, I guess you can use the onscroll event to move the alert DIV.

Or maybe I'm missing the point here which was only to show that you can override the alert function, which seems rather trivial to me - any function can be overridden in JavaScript, no?
Posted by splintor on February 3, 2005 @ 8:43 pm

umm, thats really amazing. I have never thought this would be possible. you are a freaking genius.

Its great how everything that is NOT on the box CANNOT be altered or highlighted or pressed or whatever. That was amazing.

I also agree with splintor, can you make the "window" draggable so incase something behind the "window" can be viewed after moving the window away?

also: does this mean that if I have a javascript that has poping up alert windows I can just put that source code that you showed us and just PASTE it on the header of the existing whatever-javascript and have THIS window pop up instead of old boring windows alert box?

(hope that made any sense)
Posted by kurupt on February 4, 2005 @ 1:59 am

Yep - though you'll also want the style sheet as well, of course (or your own). I'll see about adding the drag functionality soon - just a small matter of copy/paste from one of the favelets.
Posted by Steve on February 4, 2005 @ 4:27 am
Yes Steve, I remember there WAS one favlet that had something which let it drag window. I was shocked that you could even do it at first.

I never seem to stop being amazed by all these dynamic things done with nothing but javascript/dhtml/etc. I mean for me, only way to do it with flash, thats all.

Incredible stuff is on this website. Very useful when needed too. Too bad there aren't that many people today who work their asses off and then share their work so other people can learn from it and maybe use it on their site and stuff like that. you guys rock
Posted by kurupt on February 4, 2005 @ 8:32 am

is possible to change the behavior of confirm() too ?

i'll try this

would be a great and nice solution to my applications.
Posted by horaciod on February 5, 2005 @ 2:23 pm

The div "cover" works great, except for those nasty select tags (IE). Any way of covering those? I thought of hiding, but the user might need to see what is selected.
Posted by Mike on March 4, 2005 @ 4:55 pm
Mike: Just mailed you with a solution a guy I work with sent out to our web-dev list that involves a transaparent iframe in the DIV.
Posted by Steve on March 4, 2005 @ 7:56 pm
Is it possible to make a custom confirm, with correct returned values ?


Posted by Thomas on May 2, 2006 @ 9:30 am

Comments have been closed for this post.