»
AnglaisFrançaisVietnamien

Imprimer - Alerte Protection Box - JavaScriptBank.com

Version complète: jsB@nk » Divers » Alerte Protection Box
URL: https://www.javascriptbank.com/alert-box-protection.html

Alerte Protection Box © JavaScriptBank.comSouvent, quand on travaille sur des scripts d'alerte boîtes sont placées à l'intérieur de la boucle comme un outil de débogage. On peut parfois se retrouver avec des centaines de boîtes d'alerte et aucun moyen de les arrêter. Cet JavaScript placé au début de votre code vous donne une option pour désactiver le signalement des boîtes après un nombre pré-déterminé que vous avez fixée.

Version complète: jsB@nk » Divers » Alerte Protection Box
URL: https://www.javascriptbank.com/alert-box-protection.html



JavaScript
<script type=text/javascript>//Created by: Benjamin Joffe :: http://www.abrahamjoffe.com.au/ */(function(){  var a=window.alert, c=0;  window.alert=function(q){    // Change the number below to the number of alert boxes to display before the warning is given.    if (++c%5==0) {      if (!confirm(q+'\nThere have been '+c+' alert boxes, continue displaying them?')) window.alert=function(){};    } else a(q);  }})();// This is only a test case. You can removed it.function testing() {for (var i=1; i<50; i++) {  alert('This is an annoying loop of 50 alerts.\nEvery 5th alert you will have an option to exit.\n\n'+i);}}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<input type="submit" value="Press to test" onclick="testing();"><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->