FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

本论坛已关闭(禁止注册、发帖和回复)
请移步 三石和他的朋友们

FineUI首页 WebForms - MVC & Core - JavaScript 常见问题 - QQ群 - 十周年征文活动

FineUI(开源版) 下载源代码 - 下载空项目 - 获取ExtJS - 文档 在线示例 - 版本更新 - 捐赠作者 - 教程

升级到 ASP.NET Core 3.1,快、快、快! 全新ASP.NET Core,比WebForms还简单! 欢迎加入【三石和他的朋友们】(基础版下载)

搜索
查看: 4124|回复: 2
打印 上一主题 下一主题

登录按钮无反应

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-4 10:02:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
下面是我在fineuimvc的login.cshtml中的代码,怎么点击登录按钮没有反应啊,大家帮我看下啊
@{
    ViewBag.Title = "Login";
    var F = @Html.F();

}
<head>
    <title></title>
    <script src="~/res/js/Jquery/jquery-1.11.1.js"></script>
    <script src="~/res/js/jsJqueryCom/js_CommonMethod.js"></script>
    <script type="text/javascript">
        //登陆
        function login() {
            alert('112233!');
            //用户名
            var userName = ltrim(rtrim($("#username").val()));
            //密码
            var userPwd = $("#userpwd").val();
            if (userName == "") {
                alert('请输入用户名!');
                return;
            }

            //ajax请求服务数据
            $.ajax({
                url: '/Home/Login?userName=' + userName + '&userPwd=' + userPwd + '',
                success: function (httpText) {
                    //                    if (httpText == 1) {
                    //                        window.location.href = '/Home/Index';
                    //                    }
                    //                    else {
                    //                        alert('登陆失败:用户名或密码错误');
                    //                    }
                    switch (httpText) {
                        case '0':
                            alert('用户不存在!');
                            break;
                        case '1':
                            window.location.href = '/WEBKQ/ModifPwd';
                            break;
                        case '2':
                            alert('用户或密码错误!');
                            break;
                        case '3':
                            window.location.href = '/Home/Index';
                            break;
                        default:
                            alert('登陆异常:' + httpText);
                            break;

                    }
                }
            });

        }
    </script>
</head>

@section body {

    <div>
@*@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()*@
    <table border="0" style="margin:120px auto;">
        <tr style="text-align:center;">
            <td>
                <img src="../Images/Login1.png" />
            </td>
            <td style="background-image:url('../images/Login2.png'); height:367px; width:353px;">
                <table border="0" style="margin:auto; width:300px; margin-top:30px; border:0px solid red;">
                    <tr style="text-align:left; height:35px;">
                        <td colspan="2">用户名</td>
                    </tr>
                    <tr style="text-align:left; height:35px;">
                        <td colspan="2" style="background-image:url('../../images/LoginUser0.png'); background-repeat:no-repeat; height:40px; padding-left:46px;">
                            <input type="text" class="form-control" id="username" name="username">
                        </td>
                    </tr>
                    <tr style="text-align:left; height:35px;">
                        <td colspan="2">密 码</td>
                    </tr>
                    <tr style="text-align:left; height:35px;">
                        <td colspan="2" style="background-image:url('../../images/LoginPasw0.png'); background-repeat:no-repeat; height:40px; padding-left:46px;">
                            <input type="password" class="form-control" id="userpwd" name="userpwd" placeholder="Password">
                        </td>
                    </tr>
                    <tr><td colspan="2" style="height:20px;"></td></tr>
                    <tr style="text-align:left; height:40px;">
                        <td style="width:180px;">
                            <button type="submit" class="btn btn-default">登  录</button>
                        </td>
                        <td style="width:120px;">
                            <input type="checkbox" class="form-control" id="chkPwd" name="chkPwd" />记住密码
                        </td>
                    </tr>
                    <tr style="text-align:left; height:35px;">
                        <td colspan="2">
                            <p id="LbError" class="form-control"></p>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
@*}*@
    </div>
    @*<div>
    @(F.Window()
        .Width(350)
        .WindowPosition(WindowPosition.GoldenSection)
        .EnableClose(false)
        .IsModal(false)
        .Title("三诺音频服务平台")
        .ID("Window1")
        .Left(868)

        .Toolbars(
            F.Toolbar()
                .Position(ToolbarPosition.Bottom)
                .ToolbarAlign(ToolbarAlign.Right)
                .ID("Toolbar1")
                .Items(
                    F.Button()
                        .OnClick(Url.Action("btnLogin_Click"), "SimpleForm1")
                        .ValidateTarget(Target.Top)
                        .ValidateForms("SimpleForm1")
                        .Type(ButtonType.Submit)
                        .Text("登录")
                        .ID("btnLogin"),
                    F.Button()
                        .Type(ButtonType.Reset)
                        .Text("重置")
                        .ID("btnReset")
                )
        )
    )
    <br>
</div>*@

}



沙发
发表于 2017-5-4 10:11:43 | 只看该作者
<head>的内容要放到
  1. @section head {
  2. }
复制代码

里吧
板凳
发表于 2017-5-4 12:00:16 | 只看该作者
KK.Leung 发表于 2017-5-4 10:11
的内容要放到

里吧

好多问题:
1. FineUIMvc已经默认引入了 jQuery,不要再重复引入
2. JavaScript放置的位置也不对,对比下官网示例源代码,很明显的
....
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|FineUI 官方论坛 ( 皖ICP备2021006167号-1 )

GMT+8, 2024-5-2 20:14 , Processed in 0.045642 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表