Asp三级联动下拉菜单数据库版(含源程序)(2)_ASP教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:关于阻止灌水留言的一个方法(随机生成的4位认证码)
原理:在每次提交留言的时候,要输入随机生成的4位认证码. 以下代码用在ASP 生成随机4位数: % dim key randomize timer key=Int((8999)*Rnd +1000) % 在表单里显示: 认证码:%=key% input type=text name=rekey size=8 maxlength=4 input value=%=key


onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.smalllocation.length = 0; 
    
        document.myform.dlmc0.length = 0; 
document.myform.dlmc0.options[0] = new Option(’==请选择乡镇==’,’’);

    

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


<%sql2 = "select * from village order by districtid asc"
set rs2 = conn.execute(sql2)
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
        <%
        count2 = 0
        do while not rs2.eof 
        %>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("villagename"))%>","<%= trim(rs2("districtid"))%>","<%= trim(rs2("villagename"))%>");
        <%
        count2 = count2 + 1
        rs2.movenext
        loop
        rs2.close
        set rs2=nothing
        %>
onecount2=<%=count2%>;

function changelocation2(villageid)
    {
    document.myform.dlmc0.length = 0; 

    var villageid=villageid;
    var j;
    document.myform.dlmc0.options[0] = new Option(’==请选择乡镇==’,’’);
    for (j=0;j < onecount2; j++)
        {
            if (subcat2[j][1] == villageid)
            { 
                document.myform.dlmc0.options[document.myform.dlmc0.length] = new Option(subcat2[j][0], subcat2[j][2]);
            }        
        }
        
    }    
</script>

分享:asp生成HTM静态列表分页(含代码,已测试成功)
!--#include file=conn.asp-- htmlheadTITLE分页测试/TITLELINK href=inc/style.css type=text/css rel=stylesheet/head %strHead=strHeadhtml strHead=strHeadhead strHead=strHeadTITLE分页测试/TITLE strHead=strHeadLINK href=inc/style.cs

来源:模板无忧//所属分类:ASP教程/更新时间:2010-04-14
相关ASP教程