//關閉,父視窗彈出對話框,子視窗直接關閉
this.response.write("<script language=javascript>window.close();</script>");
//關閉,父視窗和子視窗都不彈出對話框,直接關閉
this.response.write("<script>");
this.response.write("{top.opener =null;top.close();}");
this.response.write("</script>");
//彈出視窗重新整理目前頁面width=200 height=200菜單。菜單欄,工具條,位址欄,狀态欄全沒有
this.response.write("<script language=javascript>window.open('rows.aspx','newwindow','width=200,height=200')</script>");
//彈出視窗重新整理目前頁面
this.response.write("<script language=javascript>window.open('rows.aspx')</script>");
this.response.write("<script>window.open('webform2.aspx','_blank');</script>");
//彈出提示視窗跳到webform2.aspx頁(在一個ie視窗中)
this.response.write(" <script language=javascript>alert('注冊成功');window.window.location.href='webform2.aspx';</script> ");
//關閉目前子視窗,重新整理父視窗
this.response.write("<script>window.opener.location.href=window.opener.location.href;window.close();</script>");
this.response.write("<script>window.opener.location.replace(window.opener.document.referrer);window.close();</script>");
//子視窗重新整理父視窗
this.response.write("<script>window.opener.location.href=window.opener.location.href;</script>");
this.response.write("<script>window.opener.location.href='webform1.aspx';</script>");
//彈出提示視窗.确定後彈出子視窗(webform2.aspx)
this.response.write("<script language='javascript'>alert('發表成功!');window.open('webform2.aspx')</script>");
//彈出提示視窗,确定後,重新整理父視窗
this.response.write("<script>alert('發表成功!');window.opener.location.href=window.opener.location.href;</script>");
//彈出相同的一頁
<input type="button" value="button" onclick="javascript:window.open(window.location.href)">
//
response.write("parent.mainframebottom.location.href='yourwebform.aspx?temp=" +str+"';");
<script language="javascript">
<!--
window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') //這句要寫成一行
-->
</script>
參數解釋:
<script language="javascript"> js腳本開始;
window.open 彈出新視窗的指令;
'page.html' 彈出視窗的檔案名;
'newwindow' 彈出視窗的名字(不是檔案名),非必須,可用空''代替;
height=100 視窗高度;
width=400 視窗寬度;
top=0 視窗距離螢幕上方的象素值;
left=0 視窗距離螢幕左側的象素值;
toolbar=no 是否顯示工具欄,yes為顯示;
menubar,scrollbars 表示菜單欄和卷軸框。
resizable=no 是否允許改變視窗大小,yes為允許;
location=no 是否顯示位址欄,yes為允許;
status=no 是否顯示狀态欄内的資訊(通常是檔案已經打開),yes為允許;
</script> js腳本結束
'newwin':隐藏菜單欄位址欄工具條
width=50:寬度
height=50:高度
scrollbars=yes/n滾動條
top=50:視窗距離螢幕上方
left=50:視窗距離螢幕左側
例:window.open('detail.aspx?id="+e.item.cells[1].text+"','newwin','width=750,height=600,scrollbars=yes,top=50,left=50');");
this.response.write("<script>window.open('webform2.aspx','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=750,height=470,left=80,top=40');</script>");
例:
例: linkcolumn1.datanavigateurlformatstring="javascript:varwin=window.open('edit_usr.aspx?actid={0}','newwin','width=750,height=600,scrollbars=yes,top=50,left=50');window.close()";
window.open
<a href="#" onclick="javascrpt:window.open('adminlove_edituser.asp?user_id=<%=rs("user_id")%>','','toolbar=no,location=no,width=540,height=360')">編審</a>
window.open 的各個屬性參數
2007-02-27 12:52:03 / 個人分類:代碼
具體總結 window.open 的各個屬性參數如下:
windowobj = window.open([url ][, name ][, features ][, replace]]]])
url:新視窗的url位址
name:新視窗的名稱,可以為空
featurse:屬性控制字元串,在此控制視窗的各種屬性,屬性之間以逗号隔開。
fullscreen= { yes/no/1/0 } 是否全屏,預設no
channelmode= { yes/no/1/0 } 是否顯示頻道欄,預設no
toolbar= { yes/no/1/0 } 是否顯示工具條,預設no
location= { yes/no/1/0 } 是否顯示位址欄,預設no
directories = { yes/no/1/0 } 是否顯示轉向按鈕,預設no
status= { yes/no/1/0 } 是否顯示視窗狀态條,預設no
menubar= { yes/no/1/0 } 是否顯示菜單,預設no
scrollbars= { yes/no/1/0 } 是否顯示滾動條,預設yes
resizable= { yes/no/1/0 } 是否視窗可調整大小,預設no
width=number 視窗寬度(像素機關)
height=number 視窗高度(像素機關)
top=number 視窗離螢幕頂部距離(像素機關)
left=number 視窗離螢幕左邊距離(像素機關)