zoukankan      html  css  js  c++  java
  • ASP新闻栏目切换+JS

    <%
    dim rs
    dim sql
    dim count
    set rs=server.createobject("adodb.recordset")
    sql = "select * from kml_sclass"
    rs.open sql,conn,1,1
    %>
    <script language = "JavaScript">
    var onecount;
    onecount=0;
    subcat = new Array();
            <%
            count = 0
            do while not rs.eof
            %>
    subcat[<%=count%>] = new Array("<%= trim(rs("sclassname"))%>","<%= trim(rs("bclassid"))%>","<%= trim(rs("sclassid"))%>");
            <%
            count = count + 1
            rs.movenext
            loop
            rs.close
            %>
    onecount=<%=count%>;

    function changelocation(locationid)
        {
        document.myform.sclassid.length = 0;

        var locationid=locationid;
        var i;
        for (i=0;i < onecount; i++)
            {
                if (subcat[i][1] == locationid)
                {
                  document.myform.sclassid.options[document.myform.sclassid.length] = new Option(subcat[i][0], subcat[i][2]);
                }       
            }
           
        }   
    </script>

    </head>
    <body>
    <br>
    <form name="myform" method="post" action="?action=addsave">
    <table width="80%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
      <tr bgcolor="#F6F6F6">
        <td height="25" colspan="2"><div align="center"><strong>修 改 新 闻</strong></div></td>
      </tr><tr bgcolor="#F6F6F6"><td align="center" height="25">新闻样式:</td><td><input name="jibie" type="radio" value="0" checked>
              中文版</td></tr>
      <tr>
        <td width="15%" height="25" align="right" bgcolor="#F6F6F6">文章类型:</td>
        <td width="85%" bgcolor="#FFFFFF">
    <%
        sql = "select * from kml_bclass"
        rs.open sql,conn,1,1
     if rs.eof and rs.bof then
     response.write "请先添加栏目。"
     response.end
     else
    %>
    <select name="bclassid" onChange="changelocation(document.myform.bclassid.options[document.myform.bclassid.selectedIndex].value)" size="1">
            <option selected value="<%=trim(rs("bclassid"))%>"><%=trim(rs("bclassname"))%></option>
            <%dim selclass
             selclass=rs("bclassid")
            rs.movenext
            do while not rs.eof
    %>
    <option value="<%=trim(rs("bclassid"))%>"><%=trim(rs("bclassname"))%></option>
    <%
    rs.movenext
    loop
    end if
    rs.close
    %>
          </select>
          <select name="sclassid">
    <%
    sql="select * from kml_sclass where bclassid="&selclass
    rs.open sql,conn,1,1
    if not(rs.eof and rs.bof) then
    %>
            <option selected value="<%=rs("sclassID")%>"><%=rs("sclassname")%></option>
    <%
    rs.movenext
    do while not rs.eof
    %>
    <option <%if RsEdit("sclassid")=rs("sclassID") then %> selected <% end if %>value="<%=rs("sclassID")%>"><%=rs("sclassname")%></option>
    <%
    rs.movenext
    loop
    end if
            rs.close
            set rs = nothing
    %>
    </select>

  • 相关阅读:
    CF700C Break Up
    CF865C Gotta Go Fast
    CF1559D2 Mocha and Diana (Hard Version)
    CF1500C Matrix Sorting
    排列计数机
    CSP-S 2021 退役记
    【做题记录】[NOIP2011 提高组] 观光公交
    【做题记录】构造题
    乱搞
    二维树状数组
  • 原文地址:https://www.cnblogs.com/tdalcn/p/691008.html
Copyright © 2011-2022 走看看