利用iframe(中的下拉列表)通过jscript付值

<td class="nr-black"  height="20" bgcolor="#FFFFFF" bordercolordark="#FFFFFF" width="37%">
<input type="hidden" name="hydmvalue" value="">
<input type="text" name="hydmnum" value="" size="3" onKeyPress="if (event.keyCode==13 || event.keyCode==10) hmqq_gethydm()" topmargin=0 marginheight=1 >
<iframe name="ifrmcm" src="../include/loadhydm.asp" style="HEIGHT: 20px; WIDTH: 170px;" marginheight=2 scrolling="no" frameborder=0 ></iframe>
</td>

 

=====

loadhydm.asp

=====

<%
  hydm=trim(request("hydm"))
%>

<html>
<head>
<title>行业代码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script src="http://www.cnblogs.com/inc/valid.js">
</script><link rel="stylesheet" href="http://www.cnblogs.com/css/button.css" type="text/css">
</head>

<body topmargin=2 leftmargin=0>
   
<script language="javascript">
<!--
     function setSele(){
     var m;
  m=window.document.all.shydm.selectedIndex;
  parent.document.thisform.hydmvalue.value=document.all.shydm.options[m].value;
  parent.document.thisform.hydmnum.value=document.all.shydm.options[m].value;
    
  }
//-->
</script>


<% 'response.write "<script language=javascript>alert('"&hydm&"')</script>"
set rs=server.createobject("adodb.recordset")
strsql="select * from ud_hydm order by len(u_hydm),left(u_hydm,1),left(u_hydm,2),left(u_hydm,3)"
rs.open strsql,conn,1,1

if rs.recordcount>0 then%>
    <select id="shydm" name="shydm" size="1" style="height: 20px; width: 485px"  onchange="setSele()">
    <option selected value="00" >yyy</option>
   <% for i=1 to rs.recordcount %>
    <option value="<%=trim(rs("u_hydm"))%>" <%if (trim(rs("u_hydm"))=hydm) then response.write "selected"%> ><%=rs("u_hymc")%></option>
      <%if (trim(rs("u_hydm"))=hydm) then %>
      <script language="javascript">
      <!--
     parent.document.thisform.hydmvalue.value="<%=hydm%>"
   //-->
   </script>
    <% end if  
       rs.movenext
    if rs.eof then
    exit for
  end if
   next%>
    </select> 
 <% else %>
    <select name="sshydm" size="1" style="height:20px;width: 200px">
        <option value="00">ttt</option>
    </select>
  <%end if
    rs.close
    set rs=nothing
   %> 
<!--#include file="disconn_db.asp"-->
</body>
</html>

posted on 2009-02-05 17:42  冉元胜  阅读(270)  评论(0编辑  收藏  举报

导航