1.广å代ç å¦ä½å¶ä½å¼¹çª
广å代ç å¦ä½å¶ä½å¼¹çª
ã1ãæåºæ¬çå¼¹åºçªå£ä»£ç ã å ¶å®ä»£ç é常ç®åï¼ <script language="javascript"> <!-- window.open ('page.html') --> </script> ã å 为çæ¯ä¸æ®µjavascripts代ç ï¼æ以å®ä»¬åºè¯¥æ¾å¨<script language="javascript">æ ç¾å</script>ä¹é´ã<!-- å -->æ¯å¯¹ä¸äºçæ¬ä½çæµè§å¨èµ·ä½ç¨ï¼å¨è¿äºèæµè§å¨ä¸ä¸ä¼å°æ ç¾ä¸ç代ç ä½ä¸ºææ¬æ¾ç¤ºåºæ¥ãè¦å »æè¿ä¸ªå¥½ä¹ æ¯åã ã window.open ('page.html') ç¨äºæ§å¶å¼¹åºæ°ççªå£page.htmlï¼å¦æpage.htmlä¸ä¸ä¸»çªå£å¨åä¸è·¯å¾ä¸ï¼åé¢åºåæè·¯å¾ï¼ç»å¯¹è·¯å¾(http://)åç¸å¯¹è·¯å¾(../)åå¯ãç¨åå¼å·ååå¼å·é½å¯ä»¥ï¼åªæ¯ä¸è¦æ··ç¨ã ã è¿ä¸æ®µä»£ç å¯ä»¥å å ¥htmlçä»»æä½ç½®ï¼<head>å</head>ä¹é´å¯ä»¥ï¼<body>é´</body>ä¹å¯ä»¥ï¼è¶åè¶æ©æ§è¡ï¼å°¤å ¶æ¯é¡µé¢ä»£ç é¿ï¼åæ³ä½¿é¡µé¢æ©ç¹å¼¹åºå°±å°½éå¾åæ¾ã ã2ãç»è¿è®¾ç½®åçå¼¹åºçªå£ã ã ä¸é¢å说ä¸è¯´å¼¹åºçªå£ç设置ãåªè¦åå¾ä¸é¢ç代ç ä¸å ä¸ç¹ä¸è¥¿å°±å¯ä»¥äºã ã æ们æ¥å®å¶è¿ä¸ªå¼¹åºççªå£çå¤è§ï¼å°ºå¯¸å¤§å°ï¼å¼¹åºçä½ç½®ä»¥éåºè¯¥é¡µé¢çå ·ä½æ åµã <script language="javascript"> <!-- window.open ('page.html',弹出弹出源码不被注入 'newwindow', 'height=, width=, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') //åæä¸è¡ --> </script> åæ°è§£éï¼ <script language="javascript"> jsèæ¬å¼å§ï¼ window.open å¼¹åºæ°çªå£çå½ä»¤ï¼ 'page.html' å¼¹åºçªå£çæ件åï¼ ã 'newwindow' å¼¹åºçªå£çååï¼ä¸æ¯æ件åï¼ï¼éå¿ é¡»ï¼å¯ç¨ç©º''代æ¿ï¼ height= çªå£é«åº¦ï¼ width= çªå£å®½åº¦ï¼ top=0 çªå£è·ç¦»å±å¹ä¸æ¹çè±¡ç´ å¼ï¼ left=0 çªå£è·ç¦»å±å¹å·¦ä¾§çè±¡ç´ å¼ï¼ toolbar=no æ¯å¦æ¾ç¤ºå·¥å ·æ ï¼yes为æ¾ç¤ºï¼ menubarï¼scrollbars 表示èåæ åæ»å¨æ ã resizable=no æ¯å¦å 许æ¹åçªå£å¤§å°ï¼yes为å è®¸ï¼ location=no æ¯å¦æ¾ç¤ºå°åæ ï¼yes为å è®¸ï¼ ã status=no æ¯å¦æ¾ç¤ºç¶ææ å çä¿¡æ¯ï¼é常æ¯æ件已ç»æå¼ï¼ï¼yes为å è®¸ï¼ </script> jsèæ¬ç»æ ã3ãç¨å½æ°æ§å¶å¼¹åºçªå£ã ä¸é¢æ¯ä¸ä¸ªå®æ´ç代ç ã <html> <head> <script language="javascript"> <!-- function openwin() { window.open ("page.html", "newwindow", "height=, width=, toolbar= ã no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //åæä¸è¡ } //--> </script> </head> <body onsubmit="openwin()"> ...ä»»æç页é¢å 容... </body> </html> ã è¿éå®ä¹äºä¸ä¸ªå½æ°openwin(),å½æ°å 容就æ¯æå¼ä¸ä¸ªçªå£ãå¨è°ç¨å®ä¹å没æä»»ä½ç¨éã æä¹è°ç¨å¢ï¼ ã æ¹æ³ä¸ï¼<body onsubmit="openwin()"> æµè§å¨è¯»é¡µé¢æ¶å¼¹åºçªå£ï¼ ã æ¹æ³äºï¼<body onunload="openwin()"> æµè§å¨ç¦»å¼é¡µé¢æ¶å¼¹åºçªå£ï¼ æ¹æ³ä¸ï¼ç¨ä¸ä¸ªè¿æ¥è°ç¨ï¼ <a href="#" onload="openwin()">æå¼ä¸ä¸ªçªå£</a> 注æï¼ä½¿ç¨ç"#"æ¯èè¿æ¥ã æ¹æ³åï¼ç¨ä¸ä¸ªæé®è°ç¨ï¼ <input type="button" onload="openwin()" value="æå¼çªå£"> ã4ãåæ¶å¼¹åº2个çªå£ã 对æºä»£ç ç¨å¾®æ¹å¨ä¸ä¸ï¼ <script language="javascript"> <!-- function openwin() ã { window.open ("page.html", "newwindow", "height=, width=, top=0,left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //åæä¸è¡ ã window.open ("page2.html", "newwindow2", "height=, width=, top=, left=,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //åæä¸è¡ } //--> </script> ã 为é¿å å¼¹åºç2个çªå£è¦çï¼ç¨topåleftæ§å¶ä¸ä¸å¼¹åºçä½ç½®ä¸è¦ç¸äºè¦çå³å¯ãæåç¨ä¸é¢è¯´è¿çåç§æ¹æ³è°ç¨å³å¯ã ã 注æï¼2个çªå£çname(newwindowsånewwindow2)ä¸è¦ç¸åï¼æè å¹²èå ¨é¨ä¸ºç©ºãokï¼ ã ã5ã主çªå£æå¼æ件1.htmï¼åæ¶å¼¹åºå°çªå£page.htmlã å¦ä¸ä»£ç å å ¥ä¸»çªå£<head>åºï¼ <script language="javascript"> <!-- function openwin() ã { window.open("page.html","","width=,height=" ) <p></p>} //--> </script> å å ¥<body>åºï¼ ã <a href="/1.htm" onload="openwin()">open</a>å³å¯ã ã6ãå¼¹åºççªå£ä¹å®æ¶å ³éæ§å¶ã ã ä¸é¢æ们å对弹åºççªå£è¿è¡ä¸äºæ§å¶ï¼ææå°±æ´å¥½äºãå¦ææ们åå°ä¸å°æ®µä»£ç å å ¥å¼¹åºç页é¢(注ææ¯å å ¥å°page.htmlçhtmlä¸ï¼å¯ä¸æ¯ä¸»é¡µé¢ä¸ï¼å¦å...)ï¼è®©å®ç§åèªå¨å ³éæ¯ä¸æ¯æ´é ·äºï¼ é¦å ï¼å°å¦ä¸ä»£ç å å ¥page.htmlæ件ç<head>åºï¼ <script language="javascript"> function closeit() { settimeout("self.close()",) //毫ç§} </script> ã ç¶åï¼åç¨<body onsubmit="closeit()"> è¿ä¸å¥è¯ä»£æ¿page.htmlä¸åæç<body>è¿ä¸å¥å°±å¯ä»¥äºã(è¿ä¸å¥è¯åä¸ä¸è¦å¿è®°ååï¼è¿ä¸å¥çä½ç¨æ¯è°ç¨å ³éçªå£ç代ç ï¼ç§éåå°±èªè¡å ³é该çªå£ã) ã7ãå¨å¼¹åºçªå£ä¸å ä¸ä¸ä¸ªå ³éæé®ã <form> <input type='button' value='å ³é' onload='window.close()'> </form> åµåµï¼ç°å¨æ´å å®ç¾äºï¼ ã8ãå å å«çå¼¹åºçªå£-ä¸ä¸ªé¡µé¢ä¸¤ä¸ªçªå£ã ã ä¸é¢çä¾åé½å å«ä¸¤ä¸ªçªå£ï¼ä¸ä¸ªæ¯ä¸»çªå£ï¼å¦ä¸ä¸ªæ¯å¼¹åºçå°çªå£ã ã éè¿ä¸é¢çä¾åï¼ä½ å¯ä»¥å¨ä¸ä¸ªé¡µé¢å å®æä¸é¢çææã <html> <head> <script language="javascript"> function openwin() ã { openwindow=window.open("", "newwin", "height=, width=,toolbar=no,scrollbars="+scroll+",menubar =no"); <p></p>//åæä¸è¡ <p></p>openwindow.document.write("<title>ä¾å</title>") <p></p>openwindow.document.write("<body bgcolor=#ffffff>") <p></p>openwindow.document.write("<h1>hello!</h1>") <p></p>openwindow.document.write("new window opened!") <p></p>openwindow.document.write("</body>") <p></p>openwindow.document.write("</html>") <p></p>openwindow.document.close()} </script> </head> <body> <a href="#" onload="openwin()">æå¼ä¸ä¸ªçªå£</a> <input type="button" onload="openwin()" value="æå¼çªå£"> </body> </html> ã çç openwindow.document.write()éé¢ç代ç ä¸å°±æ¯æ åçhtmlåï¼åªè¦æç §æ ¼å¼åæ´å¤çè¡å³å¯ãåä¸æ³¨æå¤ä¸ä¸ªæ ç¾æå°ä¸ä¸ªæ ç¾å°±ä¼åºç°é误ãè®°å¾ç¨openwindow.document.close()ç»æåã ã9ãç»æåºç¨--å¼¹åºççªå£ä¹cookieæ§å¶ã ã åæ³ä¸ä¸ï¼ä¸é¢çå¼¹åºçªå£è½ç¶é ·ï¼ä½æ¯æä¸ç¹å°æ¯ç (æ²æµ¸å¨åæ¦ä¹ä¸ï¼ä¸å®æ²¡æåç°å§ï¼)æ¯å¦ä½ å°ä¸é¢çèæ¬æ¾å¨ä¸ä¸ªéè¦é¢ç¹ç»è¿ç页é¢é(ä¾å¦é¦é¡µ)ï¼é£ä¹æ¯æ¬¡å·æ°è¿ä¸ªé¡µé¢ï¼çªå£é½ä¼å¼¹åºä¸æ¬¡ï¼æ¯ä¸æ¯é常ç¦äººï¼:-(æ解å³çåæ³åï¼yes! ;-) follow me. æ们使ç¨cookieæ¥æ§å¶ä¸ä¸å°±å¯ä»¥äºã é¦å ï¼å°å¦ä¸ä»£ç å å ¥ä¸»é¡µé¢htmlç<head>åºï¼ <script> function openwin() ã { window.open("page.html","","width=,height=" )} function get_cookie(name) { var search = name + "=" <p></p>var returnvalue = ""; <p></p>if (documents.cookie.length > 0) { <p></p>offset = documents.cookie.indexof(search) <p></p>if (offset != -1) { <p></p>offset += search.length <p></p>end = documents.cookie.indexof(";", offset); <p></p>if (end == -1) <p></p>end = documents.cookie.length; <p></p>ã returnvalue="/unescape(documents.cookie.substring( offset,end))" <p></p>} } return returnvalue; } function loadpopup(){ if (get_cookie('popped')==''){ openwin() documents.cookie="popped=yes" } } </script> ã ç¶åï¼ç¨<body onsubmit="loadpopup()">ï¼æ³¨æä¸æ¯openwinèæ¯loadpopåï¼ï¼æ¿æ¢ä¸»é¡µé¢ä¸åæç<body>è¿ä¸å¥å³å¯ãä½ å¯ä»¥è¯çå·æ°ä¸ä¸è¿ä¸ªé¡µé¢æéæ°è¿å ¥è¯¥é¡µé¢ï¼çªå£åä¹ä¸ä¼å¼¹åºäºãçæ£çpop-only-onceï¼ ã åå°è¿éå¼¹åºçªå£çå¶ä½ååºç¨æå·§åºæ¬ä¸ç®æ¯å®æäºï¼ä¿ºä¹ç´¯åäºï¼ä¸å£æ°è¯´äºè¿ä¹å¤ï¼å¸æ对æ£å¨å¶ä½ç½é¡µçæåææ帮å©ä¿ºå°±éå¸¸æ¬£æ °äºã ã éè¦æ³¨æçæ¯ï¼jsèæ¬ä¸çç大å°åæ好ååä¿æä¸è´ã