我打算在提交按钮点击时显示旋转图像(它是连续旋转)

时间:2017-04-25 15:54:40

标签: javascript jquery asp.net c#-4.0

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    function ShowProgress() {
        setTimeout(function () {
            var modal = $('<div />');
            modal.addClass("modal");
            $('body').append(modal);
            var loading = $(".loading");
            loading.show();
            var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
            var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
            loading.css({ top: top, left: left });
        }, 200);
    }
    $('form').live("submit", function () {
        ShowProgress();
    });
</script>


body {
}
.modal
    {
        position: fixed;
        top: 0;
        left: 0;
        background-color: white;
        z-index: 99;
        opacity: 0.8;
        filter: alpha(opacity=10);
        -moz-opacity: 0.8;
        min-height: 100%;
        width: 100%;
    }
    .loading
    {
        font-family: Arial;
        font-size: 10pt;
        /*border: 5px solid #67CFF5;*/
        width: 200px;
        height: 100px;
        display: none;
        position: fixed;
        /*background-color: white;*/
        z-index: 999;
    }

//在设计中                   

//Code behind(In Login button click event)
string script = "$(document).ready(function () { $('[id*=buttonLogin]').click();});";
ClientScript.RegisterStartupScript(this.GetType(), "load", script, true);

1 个答案:

答案 0 :(得分:0)

的Javascript

function showloader() {
            $('#loader').css('display', 'block');
            return true;
        }

        function hideloader() {
            $('#loader').css('display', 'none');
        }

ASPX

        <div id="loader" style="display: none">
        <img id="img_loader" alt="" class="center-block" width="100px" 
        height="100px" src="images/ajax-loader.gif" />
        </div>

C#

ClientScript.RegisterStartupScript(this.GetType(), "alert", "showloader();", true);
ClientScript.RegisterStartupScript(this.GetType(), "alert", "hideloader();", true);
相关问题