青春几米光

点击这里给我发消息

导航

过滤关键词

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>过滤关键词</title>
    <script type="text/javascript" language="JavaScript">
        var filterArray = new Array("创业","项目","广告");
//        alert(filterArray);
//        alert(typeof(filterArray));
        function check(theForm) {
        for (i=0;i<filterArray.length;i++) {
//        alert(filterArray.length);
        if (theForm.name .value.indexOf(filterArray[i])!=-1){
        alert(theForm.name .value.indexOf(filterArray[i]));
            alert("非法关键词");
            return false;}
        }
    }
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
       <input value="" type="text" name="name"/>
       <input type="submit" name="Submit" value="提交" onclick="return check(this.form)"/>
    </div>
    </form>
</body>
</html>

posted on 2013-06-19 11:23  青春几米光  阅读(231)  评论(0编辑  收藏  举报