越简单越好!

js(showModalDialog页面传值)

发表于 2008-05-06 16:12 | 1298次阅读 0次点赞   JavaScript

a.html

<html>
<script>
function Insert(){
var oSel = document.forms[0].class_id;
    var returnData = window.showModalDialog('b.html','window',"dialogHeight=250px;dialogWidth=250px;center=yes");
    oSel.options.add(new Option(returnData,returnData));

}

</script>
<body>
<form>
<select name="class_id">
<option value="111">111 </option>
</select>
<a href="javascript:void(0)" onclick="Insert()">Insert size </a>
</form>
</body>
</html>


b.html

<html>
<script>
function save(){
var oValue = document.getElementById('txt').value;
window.returnValue = oValue;
}

</script>
<body>
<input type ="text" value="" id="txt">
<input type ="button" value="保存" onclick="save()">
</body>
</html>

返回顶部 ^