javascript 弹出式窗体详解
var v=window.prompt("提示","請輸入你的名字")
2>window.confirm(text,mess) 模態確認框(返回"是/否")
if(window.confirm("tips","你確定么?")==true) alert("yes");
3>window.open([UrL],[name],[features] 打開一個新的窗體
第一個參數是目標網址,第二個是視窗名稱,第三個參數可設定視窗屬性
屬性 | 值 |
height | [Pixel] |
left | [Pixel] |
location | yes|no |
menubar | yes|no |
resizable | yes|no |
scrollbars | yes|no |
status | yes|no |
toolbar | yes|no |
top | [Pixel] |
width | [Pixel] |
newwindow=window.open("test.html","new one","width:300px");
newwindow.document.write("AAA")
4>
window.showModalDialog()方法用來創建一個顯示HTML內容的模態對話框。
window.showModelessDialog()方法用來創建一個顯示HTML內容的非模態對話框
使用方法:
vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])
其中第2個vArguments是表示傳遞參數
接收方法為 var obj = window.dialogArguments
返回給父窗體的方法 window.returnValue="the result"
例如:
var bc=window.showModalDialog("myhtml.html","ccc","dialogWidth=200px;dialogHeight=100px");
alert(bc);
假如
myhtml.html 中 關閉前有個window.returnValue="abc"
則bc="abc"
5>XMLHTTP (Ajax的基本)




















