HTML DOM close() ·½·¨
¶¨ÒåºÍÓ÷¨
close() ·½·¨ÓÃÓڹرÕä¯ÀÀÆ÷´°¿Ú¡£
Óï·¨
window.close()
˵Ã÷
·½·¨ close() ½«¹Ø±ÕÓÐ window Ö¸¶¨µÄ¶¥²ãä¯ÀÀÆ÷´°¿Ú¡£Ä³¸ö´°¿Ú¿ÉÒÔͨ¹ýµ÷Óà self.close() »òÖ»µ÷Óà close() À´¹Ø±ÕÆä×ÔÉí¡£
Ö»ÓÐͨ¹ý JavaScript ´úÂë´ò¿ªµÄ´°¿Ú²ÅÄܹ»ÓÉ JavaScript ´úÂë¹Ø±Õ¡£Õâ×èÖ¹Á˶ñÒâµÄ½Å±¾ÖÕÖ¹Óû§µÄä¯ÀÀÆ÷¡£
ʵÀý
ÏÂÃæµÄÀý×ӿɹرÕеÄä¯ÀÀÆ÷£º
<html> <head> <script type="text/javascript"> function closeWin() { myWindow.close() } </script> </head> <body> <script type="text/javascript"> myWindow=window.open('','','width=200,height=100') myWindow.document.write("This is 'myWindow'") </script> <input type="button" value="Close 'myWindow'" onclick="closeWin()" /> </body> </html>