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

谁能给我提供个子页面向父页面回传值的简单程序,50分奉送!!!
谁能给我提供个子页面向父页面回传值的简单程序,50分奉送!!!

------解决方案--------------------
http://community.csdn.net/Expert/topic/5156/5156169.xml?temp=.8237879
------解决方案--------------------
function getUserId(id)
{

var callbackObj=opener.document.getElementById( " <%=request( "callback ") %> ");
callbackObj.value=id;
window.close();

}
这是在子页面调用的一段回传数据的函数,自己研究去一下吧
------解决方案--------------------
window.top.document.all[ "表单项目 "]= " "
------解决方案--------------------
我改写了某个网站后台程序段,希望对你有帮助,以下代码测试通过,结合你自己从数据库中得来的值改写一下就行了

父窗口 parent.asp
<form method= "POST " action= " " name= "FrontPage_Form1 " >
纬度: <input type= "text " name= "Latitude " size= "25 " id= "latitudevalue " value= " "> <br>
经度: <input type= "text " name= "Longitude " size= "25 " id= "longitudevalue " value= " "> <br>
<input type=button onclick=window.open( "pop.asp ") value=开子窗口>
</form>


子窗口 pop.asp
<%
'建立连接和rs对象...
'Latitude = rs( "Latitude ")
'Longitude = rs( "Longitude ")

Latitude = 12 '测试用赋值
Longitude = 34

response.write "纬度: " & Latitude
response.write "经度: " & Longitude

%>


<script>
function doTransmit(){
if (confirm( "纬度: " + <%=Latitude%> + "\n经度: " + <%=Longitude%> + "\n\n是否填写此坐标,并关闭子窗口? " ) )
{
opener.parent.document.FrontPage_Form1.latitudevalue.value = <%=Latitude%> ; //将数据库中取出的值传回父窗口
opener.parent.document.FrontPage_Form1.longitudevalue.value = <%=Longitude%> ;
self.close(); //关闭子窗口
}
}
</script>


<input type=button onclick= "doTransmit() " value=传值>