1.广å代ç å¦ä½å¶ä½å¼¹çª
广å代ç å¦ä½å¶ä½å¼¹çª
ã1ãæåºæ¬çå¼¹åºçªå£ä»£ç ãå ¶å®ä»£ç é常ç®åï¼<scriptlanguage="javascript"><!--windowopen('page
html')--></script>å 为çæ¯ä¸æ®µjavascripts代ç ï¼æ以å®ä»¬åºè¯¥æ¾å¨<scriptlanguage="javascript">æ ç¾å</script>ä¹é´
<!--å-->æ¯å¯¹ä¸äºçæ¬ä½çæµè§å¨èµ·ä½ç¨ï¼å¨è¿äºèæµè§å¨ä¸ä¸ä¼å°æ ç¾ä¸ç代ç ä½ä¸ºææ¬æ¾ç¤ºåºæ¥
è¦å »æè¿ä¸ªå¥½ä¹ æ¯å
window
open('page
html')ç¨äºæ§å¶å¼¹åºæ°ççªå£page
htmlï¼å¦æpage
htmlä¸ä¸ä¸»çªå£å¨åä¸è·¯å¾ä¸ï¼åé¢åºåæè·¯å¾ï¼ç»å¯¹è·¯å¾(p>
/)åå¯
ç¨åå¼å·ååå¼å·é½å¯ä»¥ï¼åªæ¯ä¸è¦æ··ç¨
è¿ä¸æ®µä»£ç å¯ä»¥å å ¥htmlçä»»æä½ç½®ï¼<head>å</head>ä¹é´å¯ä»¥ï¼<body>é´</body>ä¹å¯ä»¥ï¼è¶åè¶æ©æ§è¡ï¼å°¤å ¶æ¯é¡µé¢ä»£ç é¿ï¼åæ³ä½¿é¡µé¢æ©ç¹å¼¹åºå°±å°½éå¾åæ¾
ã2ãç»è¿è®¾ç½®åçå¼¹åºçªå£ãä¸é¢å说ä¸è¯´å¼¹åºçªå£ç设置
åªè¦åå¾ä¸é¢ç代ç ä¸å ä¸ç¹ä¸è¥¿å°±å¯ä»¥äº
æ们æ¥å®å¶è¿ä¸ªå¼¹åºççªå£çå¤è§ï¼å°ºå¯¸å¤§å°ï¼å¼¹åºçä½ç½®ä»¥éåºè¯¥é¡µé¢çå ·ä½æ åµ
<scriptlanguage="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>åæ°è§£éï¼<scriptlanguage="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><scriptlanguage="javascript"><!--functionopenwin(){ window
open("page
html","newwindow","height=,width=,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no")//åæä¸è¡}//--></script></head><bodyonsubmit="openwin()">
ä»»æç页é¢å 容
</body></html>è¿éå®ä¹äºä¸ä¸ªå½æ°openwin(),å½æ°å 容就æ¯æå¼ä¸ä¸ªçªå£
å¨è°ç¨å®ä¹å没æä»»ä½ç¨é
æä¹è°ç¨å¢ï¼æ¹æ³ä¸ï¼<bodyonsubmit="openwin()">æµè§å¨è¯»é¡µé¢æ¶å¼¹åºçªå£ï¼æ¹æ³äºï¼<bodyonunload="openwin()">æµè§å¨ç¦»å¼é¡µé¢æ¶å¼¹åºçªå£ï¼æ¹æ³ä¸ï¼ç¨ä¸ä¸ªè¿æ¥è°ç¨ï¼<ahref=""onload="openwin()">æå¼ä¸ä¸ªçªå£</a>注æï¼ä½¿ç¨ç""æ¯èè¿æ¥
æ¹æ³åï¼ç¨ä¸ä¸ªæé®è°ç¨ï¼<inputtype="button"onload="openwin()"value="æå¼çªå£">ã4ãåæ¶å¼¹åº2个çªå£ã对æºä»£ç ç¨å¾®æ¹å¨ä¸ä¸ï¼<scriptlanguage="javascript"><!--functionopenwin(){ 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>åºï¼<scriptlanguage="javascript"><!--functionopenwin(){ window
open("page
html","","width=,height=")<p></p>}//--></script>å å ¥<body>åºï¼<ahref="/1
htm"onload="openwin()">open</a>å³å¯
ã6ãå¼¹åºççªå£ä¹å®æ¶å ³éæ§å¶ãä¸é¢æ们å对弹åºççªå£è¿è¡ä¸äºæ§å¶ï¼ææå°±æ´å¥½äº
å¦ææ们åå°ä¸å°æ®µä»£ç å å ¥å¼¹åºç页é¢(注ææ¯å å ¥å°page
htmlçhtmlä¸ï¼å¯ä¸æ¯ä¸»é¡µé¢ä¸ï¼å¦å
)ï¼è®©å®ç§åèªå¨å ³éæ¯ä¸æ¯æ´é ·äºï¼é¦å ï¼å°å¦ä¸ä»£ç å å ¥page
htmlæ件ç<head>åºï¼<scriptlanguage="javascript">functioncloseit(){ settimeout("self
close()",)//毫ç§}</script>ç¶åï¼åç¨<bodyonsubmit="closeit()">è¿ä¸å¥è¯ä»£æ¿page
htmlä¸åæç<body>è¿ä¸å¥å°±å¯ä»¥äº
(è¿ä¸å¥è¯åä¸ä¸è¦å¿è®°ååï¼è¿ä¸å¥çä½ç¨æ¯è°ç¨å ³éçªå£ç代ç ï¼ç§éåå°±èªè¡å ³é该çªå£
)ã7ãå¨å¼¹åºçªå£ä¸å ä¸ä¸ä¸ªå ³éæé®ã<form><inputtype='button'value='å ³é'onload='window
close()'></form>åµåµï¼ç°å¨æ´å å®ç¾äºï¼ã8ãå å å«çå¼¹åºçªå£-ä¸ä¸ªé¡µé¢ä¸¤ä¸ªçªå£ãä¸é¢çä¾åé½å å«ä¸¤ä¸ªçªå£ï¼ä¸ä¸ªæ¯ä¸»çªå£ï¼å¦ä¸ä¸ªæ¯å¼¹åºçå°çªå£
éè¿ä¸é¢çä¾åï¼ä½ å¯ä»¥å¨ä¸ä¸ªé¡µé¢å å®æä¸é¢çææ
<html><head><scriptlanguage="javascript">functionopenwin(){ 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("<bodybgcolor=ffffff>")<p></p>openwindow
document
write("<h1>hello!</h1>")<p></p>openwindow
document
write("newwindowopened!")<p></p>openwindow
document
write("</body>")<p></p>openwindow
document
write("</html>")<p></p>openwindow
document
close()}</script></head><body><ahref=""onload="openwin()">æå¼ä¸ä¸ªçªå£</a><inputtype="button"onload="openwin()"value="æå¼çªå£"></body></html>ççopenwindow
document
åä¸æ³¨æå¤ä¸ä¸ªæ ç¾æå°ä¸ä¸ªæ ç¾å°±ä¼åºç°é误
è®°å¾ç¨openwindow
document
close()ç»æå
ã9ãç»æåºç¨--å¼¹åºççªå£ä¹cookieæ§å¶ãåæ³ä¸ä¸ï¼ä¸é¢çå¼¹åºçªå£è½ç¶é ·ï¼ä½æ¯æä¸ç¹å°æ¯ç (æ²æµ¸å¨åæ¦ä¹ä¸ï¼ä¸å®æ²¡æåç°å§ï¼)æ¯å¦ä½ å°ä¸é¢çèæ¬æ¾å¨ä¸ä¸ªéè¦é¢ç¹ç»è¿ç页é¢é(ä¾å¦é¦é¡µ)ï¼é£ä¹æ¯æ¬¡å·æ°è¿ä¸ªé¡µé¢ï¼çªå£é½ä¼å¼¹åºä¸æ¬¡ï¼æ¯ä¸æ¯é常ç¦äººï¼:-(æ解å³çåæ³åï¼yes!;-)followme
æ们使ç¨cookieæ¥æ§å¶ä¸ä¸å°±å¯ä»¥äº
é¦å ï¼å°å¦ä¸ä»£ç å å ¥ä¸»é¡µé¢htmlç<head>åºï¼<script>functionopenwin(){ window
open("page
html","","width=,height=")}functionget_cookie(name){ varsearch=name+"="<p></p>varreturnvalue="";<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>}}returnreturnvalue;}functionloadpopup(){ if(get_cookie('popped')==''){ openwin()documents
cookie="popped=yes"}}</script>ç¶åï¼ç¨<bodyonsubmit="loadpopup()">ï¼æ³¨æä¸æ¯openwinèæ¯loadpopåï¼ï¼æ¿æ¢ä¸»é¡µé¢ä¸åæç<body>è¿ä¸å¥å³å¯
ä½ å¯ä»¥è¯çå·æ°ä¸ä¸è¿ä¸ªé¡µé¢æéæ°è¿å ¥è¯¥é¡µé¢ï¼çªå£åä¹ä¸ä¼å¼¹åºäº
çæ£çpop-only-onceï¼åå°è¿éå¼¹åºçªå£çå¶ä½ååºç¨æå·§åºæ¬ä¸ç®æ¯å®æäºï¼ä¿ºä¹ç´¯åäºï¼ä¸å£æ°è¯´äºè¿ä¹å¤ï¼å¸æ对æ£å¨å¶ä½ç½é¡µçæåææ帮å©ä¿ºå°±éå¸¸æ¬£æ °äº
éè¦æ³¨æçæ¯ï¼jsèæ¬ä¸çç大å°åæ好ååä¿æä¸è´