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

iframe 传值的问题
1.asp   iframe   2.asp

2.asp中有一个循环读出数据,点 <%=rs( "M_zh ")%> 内容把查询到的三个数据分别是
<%=rs( "M_zh ")%>   提交到1.ASP   的M_xtb_11.value中, <%=rs( "m_xt ")%> 1.ASP   的M_xtb_12.value中,, <%=rs( "m_cj ")%> 1.ASP   的M_xtb_13.value中,

2.ASP提交内容大概如下:
do   while   not   rs.eof

<td   width= "95 "   onClick= "javascript:parent.document.form1.M_xtb_11.value= ' <%=rs( "M_zh ")%> ';javascript:parent.document.form1.M_xtb_12.value= ' <%=rs( "m_xt ")%> ';javascript:parent.document.form1.M_xtb_13.value= ' <%=rs( "m_cj ")%> '; "> <a   href= "# "> <%=rs( "M_zh ")%> </a> </td>

rs.movenext
loop

问题是:为什么提交的时候第一条数据一直不能提交,提示:未结束的字符传常量
还有这种写法对么?


------解决方案--------------------
1.asp
<form name= "form1 ">
<input type= "text " name= "M_xtb_11 "> <br>
<input type= "text " name= "M_xtb_12 "> <br>
<input type= "text " name= "M_xtb_13 "> <br>
<iframe src= "2.asp " width= "100% " height= "500 " id= "f1 ">
</form>


2.asp:
<script language= "JavaScript " type= "text/javascript ">
<!--
function gValue(obj)
{
var TRObj=obj.parentNode.parentNode;
parent.document.form1.M_xtb_11.value=TRObj.cells[0].innerText;
parent.document.form1.M_xtb_12.value=TRObj.cells[1].innerText;
parent.document.form1.M_xtb_13.value=TRObj.cells[2].innerText;
}
//-->
</script>
</head>

<body>
<table width= "100% " border= "1 ">
<%
do while not rs.eof
%>
<tr>
<td> <a href= "javascript:void(0); " onclick= "gValue(this) "> <%=rs( "M_zh ")%> </a> </td>
<td> <%=rs( "m_xt ")%> </td>
<td> <%=rs( "m_cj ")%> </td>
</tr>
<%
rs.movenext
loop
%>
</table>
------解决方案--------------------
在代码中看不出什么问题来,要是代码真的没有问题就是你的数据有问题了,数据里不能有 ' "> 等HTML所用到的,我看在你的数据中就一定包含了上面我所说的字符了。