<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function btnTest_Click(){
window.showModalDialog("javascript:document.write('Write by script');");
}
</script>
</head><body>
<input type="button" value="Click" name="btnTest" id="btnTest" onClick="btnTest_Click()">
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script>
function btnTest_Click(){
window.showModalDialog("javascript:document.write('Write by script');");
}
</script>
</head><body>
<input type="button" value="Click" name="btnTest" id="btnTest" onClick="btnTest_Click()">
</body>
</html>
能麻烦你再给个稍复杂点的例子吗?
比如我在父窗口有一个文本框,ModalDialog窗口中也document.write出一个文本框,当关闭这个ModalDialog窗口时将该文本框的值填加到父窗口的文件框中。我现在的需求是这个ModalDialog窗口不能是已经存在的文件,只能是在代码中创建中用document.write加入网页元素。