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

菜鸟求教:请帮我看看这段代码有什么问题,老是出现错误!!!
父页面:
<form   action= "save_juan.asp "   method= "post "   enctype= "multipart/form-data "   name= "myform ">
<input   type= "text "   size= "12 "   name= "guan_style "   id= "guan_styleid "   value= " ">
                                            <input   type= "button "   value= "请选择... "   onClick= "window.open( 'select_style.asp '); ">
</form>


子页面:
<%
Dim   returnvalue1
returnvalue1=rs_s( "style_url ")
response.Write(returnvalue1)
%>
<script   language= "javascript ">
                                      function   doTransmit(){
                                      opener.parent.document.myform.guan_styleid.value     = <%=returnvalue1%> ;   //将数据库中取出的值传回父窗口
                                      self.close();//关闭子窗口
                                      }
                                </script>
<input   type= "button "   onclick= "javascript:doTransmit(); "   value= "传值 ">


把值加传到父页面,总是出错,大家帮我看看,多谢!!!

------解决方案--------------------
给你个例子自己看看吧
test.asp
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> </title>
</head>
<body>
<form name= "form ">
<input type= "text " name= "aa ">
<input type= "button " onClick= "javascript:window.open( 'test0.asp '); ">
</form>
</body>
</html>

test0.asp
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> </title>
</head>
<body>
<script language= "javascript ">
function PostValue()
{
window.opener.document.form.aa.value = "test ";
window.close();
}
</script>
<form name= "form ">
<input type= "button " onClick= "javascript:PostValue(); ">
</form>
</body>
</html>
------解决方案--------------------
如果你一定要获取ASP里的变量,请把 <script language= "javascript "> 改成 <script type= "text/javascript ">
.value= " <% =returnvalue1 %> ";