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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RESET window.alert=null???

Status
Not open for further replies.

mattscotney

Programmer
Jul 31, 2002
57
AU
Hi all,

The following JavaScript stops the alert box being used on a page:

<SCRIPT LANGUAGE = &quot;Javascript&quot;>

window.alert=null;
alert(&quot;This alert will not show&quot;);

</SCRIPT>

If you run the above code you will not get an alert box. Is there a way to reset the window.alert event so that an alert box will show up?

Thanks in advance,
Matt Scotney
 
Just curious,

Why would you want to use window.alert=null in the first place? If you're looking to keep alerts from popping up under certain circumstances, just use an IF statement.

As far as I know or can find, once you set window.alert=null, there's no going back (I may well be wrong though).

How 'bout something like this?

<SCRIPT LANGUAGE = &quot;Javascript&quot;>
var AlertsOn = false
if ((AlertsOn) == true) {alert(&quot;Message&quot;);}
</SCRIPT>

Then all you have to do is set AlertsOn to &quot;true&quot; when you want alerts to display.
 
Moebius01,

For your curiousity I am dynamically generating remote pages using ASP, some of the pages which I generate contain window.alert=null.

In some instances the window.alert=null is written in obfuscated code so generally I can not just replace the string because it does not exsist in an open format.

That is why I would like to know how to reset it. I have done quite a bit of research myself and can not seem to find a way around it using a simple method which works for all cases.

If anyone knows of a window.alert.reset function or something simular it would be appreciated.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top