| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2824 人关注过本帖
标题:clientscript.registerstarupscript
只看楼主 加入收藏
未来大仙
Rank: 6Rank: 6
来 自:黑窟窿
等 级:侠之大者
威 望:4
帖 子:263
专家分:491
注 册:2015-6-20
结帖率:70%
收藏
 问题点数:0 回复次数:0 
clientscript.registerstarupscript
程序代码:
<!DOCTYPE html>

<html xmlns="http://www.">
<head><meta http-equiv="Content-Type" content="textml; charset=utf-8" /><title>

</title></head>
<body>
    <form method="post" action="./LandingpPage.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="3Tw4SA4WZSrTCGdmdo1TDS54/TVWMWh87lnm62gsYRJR3AC5VAQF6+6ZnDnSLYNJXf2XNpQC2RhpYMdSEqv7AxC0vb0JaRM6lA8yr73R77xSQBQF8WVxokUhhf6wYFGO" />
</div>

<div class="aspNetHidden">

    <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="14C49897" />
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="U1/47TOl8WrYiuiCe/XXXcK43ukKNw82GRNzlqhyYAC1PAPweSPm4ykjZJlThQhVFapGrDQB4MuzqPlDux+9jzSW58E/KAMt7hL4N1cmuQoFrj7P6J+iWgvQamCmxALdHWC5eNH9FtCw1jeeGrGXLy8hV/qS4pfz3RRv5x9WV2ElcZxzcZqLU56Dkuz4nTl7W3qL6Kk1t4QbgEdZo0urNZt8yaK2kvtocIzkE90qjBRScFk2zMl7S2ExDbHrj9Dg" />
</div>
    <div>
    
    </div>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <span id="Land">登陆名:</span>
        <input name="PrintUser" type="text" id="PrintUser" />
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <span id="Passwd">密码:</span>
            &nbsp;
            <input name="PrintPasswd" type="password" id="PrintPasswd" />
        </p>
        <span id="Label1">   </span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="submit" name="Landing" value="登陆" id="Landing" style="height: 27px" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="submit" name="ModifyPwd" value="修改密码" id="ModifyPwd" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <select name="Identify_LandingPage" id="Identify_LandingPage">
    <option selected="selected" value=""></option>
    <option value="管理员">管理员</option>
    <option value="普通职工">普通职工</option>

<lect>
        </p>
        <script></script>
    </form>
</body>
<ml>

程序代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using ModifyPwd;

namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        public string strCnn;

        private string id;
        private string pwd;
        private string identify;
        private string id2;                // 从数据库读出
        private string pwd2;
        private string identify2;
        protected void Page_Load(object sender, EventArgs e)
        {
        
        }
        protected void Landing_Click1(object sender, EventArgs e)
        {
            strCnn = "data source=localhost;initial catalog=学校工资管理系统;user id=sa;" + "pwd=520524";
            SqlConnection sqlCnn = new SqlConnection();
            sqlCnn.ConnectionString = strCnn;
            sqlCnn.Open();
            SqlCommand sqlcmd = sqlCnn.CreateCommand();
             = "select ID,Pwd,Identify from UserName where" + " ID ='" + id + "' ";
            SqlDataReader sqlReader = sqlcmd.ExecuteReader();
            if (sqlReader.Read())
            {
                id2 = (string)sqlReader[0];
                pwd2 = (string)sqlReader[1];
                identify2 = (string)sqlReader[2];
            }
            sqlReader.Close();
            if (id == null || pwd == null)
                ClientScript.RegisterStartupScript(GetType(), "NullUser", "alter('请输入账号密码!')", true);
            if (id2 == null || pwd != pwd2)
                ClientScript.RegisterStartupScript(GetType(), "WrongUser", "alter('账号或者密码错误!')", true);
            else
            {
                if (identify2 == identify)
                    Response.Redirect("MainPage.aspx");
                else
                    ClientScript.RegisterStartupScript(GetType(), "None", "alter('你没有这个权限!')", true);
            }
        }
        
        protected void ModifyPwd_Click(object sender, EventArgs e)
        {
            Response.Redirect("ModifyPwdPage.aspx");
        }
        protected void PrintUser_TextChanged(object sender, EventArgs e)
        {
            id = PrintUser.Text;
        }
        protected void Identify_LandingPage_SelectedIndexChanged(object sender, EventArgs e)
        {
            identify = Identify_LandingPage.Text;
        }

        protected void PrintPasswd_TextChanged1(object sender, EventArgs e)
        {
            pwd = PrintPasswd.Text;
        }


    }
}



上面是html代码,下面是asp源码,问题就是为什么clientscript会失效,就是根本不会弹出提示窗口

ps:他有执行clientscript语句,亲手调试过。

搜索更多相关主题的帖子: action method color title 
2017-05-17 20:01
快速回复:clientscript.registerstarupscript
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035892 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved