重写Alert
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Insert title here</title> 6 <script type="text/javascript"> 7 var orginalert = window.alert; 8 window.alert = function(message){ 9 var frm = document.frm; 10 frm.action = "./popup.html"; 11 var winpop = window.open("","targetopoup","width=700,height=500,location=no,resizable=no");//top=0,left=0, 12 frm.target = "targetopoup"; 13 frm.submit(); 14 frm.target = ""; 15 winpop.focus(); 16 } 17 18 function originbuttonclick(){ 19 20 orginalert("orginalert"); 21 } 22 function resetbuttonclick(){ 23 24 alert("orginalert"); 25 } 26 </script> 27 </head> 28 <body> 29 <input type="button" value="originbutton" onclick="originbuttonclick()"> 30 <input type="button" value="resetbutton" onclick="resetbuttonclick()"> 31 <form action="" id = "frm" name="frm"> 32 33 </form> 34 </body> 35 </html>
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Insert title here</title> 6 <script type="text/javascript"> 7 function testload(){ 8 //alert("3434"); 9 window.moveTo(0,0); 10 window.resizeTo(screen.availWidth,screen.availHeight); 11 window.outerWidth=screen.availWidth; 12 window.outerHeight=screen.availHeight; 13 } 14 </script> 15 </head> 16 <body onload="testload()"> 17 <h1>hahah</h1> 18 </body> 19 </html>