日期:2014-05-17  浏览次数:22250 次

请都如何回传值?解决给分,不好意思。分不多!!!
比如,我在a.asp中
<form   name= "myform "....>
    <input   type= "text "   name= "textfield1 "   value= " ">
    <input   type= "button "   value= "请选择 "   onclick= "javascript:popwin( 'b.asp '); ">
打开后在b.asp中
<form   name= "myform1 "....>
    <input   type= "hidden "   name= "textfield2 "   value= "rs( "id ") ">
    <input   type= "button "   value= "选择 ">

现在就是说,我如何把rs( "id ")回传到a.asp中的textfield1.value=???
请大家教教我。多谢!!!

------解决方案--------------------
这样试试行不?在b.asp中
<form name= "myform1 "....>
<input type= "hidden " name= "textfield2 " value= "rs( "id ") ">
<input type= "button " value= "选择 " onclick= "javascript:window.opener.document.all.textfield1.value=document.all.textfield2.value ">
------解决方案--------------------
可以。不要用弹出窗口。用showModalDialog,属于javascript,懒的写代码,自己查一下相关方法。给你个提示:showModalDialog是用returnValue往回传值的。
------解决方案--------------------
txz2003(努力学习) 的方法应该可以 的啊~
------解决方案--------------------
用javascript的window.open方法,在b中用returnWindow回传你需要的值就可以了
------解决方案--------------------
父窗口页代码
<HTML> <BODY>
<input type= "text " id= "txt " size=20>
<input type= "text " id= "txt1 " size=20>
<button onclick= "echo() "> input </button>
<script>
function echo() {
x = showModalDialog( "testnew.html ",new Array(txt.value, txt1.value));
txt.value = x[0];//.txt1;
txt1.value = x[1];//.txt2;
}
</script>
</BODY> </HTML>


子窗口代码 网页名:testnew.html
<HTML> <BODY>
<input type= "text " name= "dlgtxt ">
<input type= "text " name= "dlgtxt1 ">
<button onclick= "doSomething() "> do somthing </button>
<script>
dlgtxt.value = window.dialogArguments[0];
dlgtxt1.value = window.dialogArguments[1];

function doSomething(){
var m_data = new Object;
m_data.txt1 = dlgtxt.value;
m_data.txt2 = dlgtxt1.value;
window.returnValue = [dlgtxt.value, dlgtxt1.value];
close();
}
</script>
</BODY> </HTML>