做了个简单的例子供你参考。
<html>
<head>
<title>test button</title>
</head>
<script language="javascript">
function doTest(){
var inputval;
inputval = prompt("Please input the value");
alert(inputval);
text1.value=inputval;
}
</script>
<body>
<input type="text" id="text1" value=""/>
<input type="button" value="set" onclick="doTest()"/>
</body>
</html>也可以用showModalDialog等其它的方法来实现。
<html>
<head>
<title>test button</title>
</head>
<script language="javascript">
function doTest(){
var inputval;
inputval = prompt("Please input the value");
alert(inputval);
text1.value=inputval;
}
</script>
<body>
<input type="text" id="text1" value=""/>
<input type="button" value="set" onclick="doTest()"/>
</body>
</html>也可以用showModalDialog等其它的方法来实现。
子窗口下面的話:window.openner.文本框名字.value = 取得的节点名字字符
父窗口下面的話:var Cwin = window.open(...)
document.文本框名字.value = Cwin.取得的节点名字字符
<html>
<head>
<title>test button</title>
</head>
<script language="javascript">
function doTest(){
var inputval;
inputval = showModalDialog("inputdlg.html",window.text1.value,"dialogWidth:350px;dialogHeight:150px;help:no;status:no");
text1.value=inputval;
}
</script>
<body>
<hr/>
<input type="text" id="text1" value=""/>
<input type="button" value="OK" onclick="doTest()"/>
</body>
</html>子窗口
<html>
<head>
<title>test button</title>
</head>
<script language="javascript">
function wndOnLoad(){
window.text1.value = window.dialogArguments;
}
function doTest(){
window.returnValue = window.text1.value;
window.close();
}
</script>
<body onload="wndOnLoad();">
<br/>
<table align="center">
<tr>
<td>
<input type="text" id="text1" value=""/><br/>
<input type="button" value="set" onclick="doTest()"/>
</td>
</tr>
</table>
</body>
</html>