• 如何设置提交后让页面处于等待状态


     

    var oProgressLayer=null;
    /************************************************************************************************
    // 设置网页上所有元素为不可响应事件,以及设置鼠标光标为wait
    *************************************************************************************************/
    function SetBusy(){
    for(var iCnt=0;iCnt<document.all.length;iCnt++){
    try{document.all[iCnt].oldCursor=document.all[iCnt].style.cursor;
    document.all[iCnt].style.cursor='wait';}catch(e){;}
    try{document.all[iCnt].oldonmousedown=document.all[iCnt].onmousedown;
    document.all[iCnt].onmousedown=function(){return false;}}catch(e){;}
    try{document.all[iCnt].oldonclick=document.all[iCnt].onclick;
    document.all[iCnt].onclick=function(){return false;}}catch(e){;}
    try{document.all[iCnt].oldonmouseover=document.all[iCnt].onmouseover;
    document.all[iCnt].onmouseover=function(){return false;}}catch(e){;}
    try{document.all[iCnt].oldonmousemove=document.all[iCnt].onmousemove;
    document.all[iCnt].onmousemove=function(){return false;}}catch(e){;}
    try{document.all[iCnt].oldonkeydown=document.all[iCnt].onkeydown;
    document.all[iCnt].onkeydown=function(){return false;}}catch(e){;}
    try{document.all[iCnt].oldoncontextmenu=document.all[iCnt].oncontextmenu;
    document.all[iCnt].oncontextmenu=function(){return false;}}catch(e){;}
    try{document.all[iCnt].oldonselectstart=document.all[iCnt].onselectstart;
    document.all[iCnt].onselectstart=function(){return false;}}catch(e){;}
    }
    }
    /************************************************************************************************
    // 恢复网页上所有元素可以响应事件,以及设置鼠标光标默认光标
    *************************************************************************************************/
    function ReleaseBusy(){
    for(var iCnt=0;iCnt<document.all.length;iCnt++){
    try{document.all[iCnt].style.cursor=document.all[iCnt].oldCursor;}catch(e){;}
    try{document.all[iCnt].onmousedown=document.all[iCnt].oldonmousedown;}catch(e){;}
    try{document.all[iCnt].onclick=document.all[iCnt].oldonclick;}catch(e){;}
    try{document.all[iCnt].onmouseover=document.all[iCnt].oldonmouseover;}catch(e){;}
    try{document.all[iCnt].onmousemove=document.all[iCnt].oldonmousemove;}catch(e){;}
    try{document.all[iCnt].onkeydown=document.all[iCnt].oldonkeydown;}catch(e){;}
    try{document.all[iCnt].oncontextmenu=document.all[iCnt].oldoncontextmenu;}catch(e){;}
    try{document.all[iCnt].onselectstart=document.all[iCnt].oldonselectstart;}catch(e){;}
    }
    }
    /************************************************************************************************
    // 关闭“正在处理"对话框
    *************************************************************************************************/
    function HideProgressInfo(){
    if(oProgressLayer){
    //ReleaseBusy();
    oProgressLayer.removeNode(true);
    oProgressLayer=null;
    }
    }
    /************************************************************************************************
    // 显示“正在处理”对话框 (样式一) 动画光标样式
    *************************************************************************************************/
    function ShowProgressInfo(){

    if(oProgressLayer) return;
    oProgressLayer=document.createElement('DIV');
    with(oProgressLayer.style){
    width='230px';
    height='70px';
    position='absolute';
    left=(document.body.clientWidth-230)>>1;
    top=(document.body.clientHeight-70)>>1;
    backgroundColor='buttonFace';
    borderLeft='solid 1px silver';
    borderTop='solid 1px silver';
    borderRight='solid 1px gray';
    borderBottom='solid 1px gray';
    fontWeight='700';
    fontSize='13px';
    zIndex='999';
    }
    oProgressLayer.innerHTML=
    '<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">'+
    '<tr>'+
    '<td align="center" valign="middle">'+
    '<img src="/Images/Processing.gif" border="0" align="absmiddle" />'+
    '&nbsp;&nbsp;正在处理数据,请稍候……'+
    '</td>'+
    '</tr>'+
    '</table>';
    document.body.appendChild(oProgressLayer);
    //SetBusy();
    }
    /************************************************************************************************
    // 显示“正在处理”对话框 (样式二) 进度条样式
    *************************************************************************************************/
    function ShowProgressInfo1( message ){
    if(oProgressLayer) return;
     //SetBusy();

    oProgressLayer=document.createElement('DIV');
    with(oProgressLayer.style){
    width='230px';
    height='70px';
    position='absolute';
    left=(document.body.clientWidth-230)>>1;
    top=(document.body.clientHeight-70)>>1;
    backgroundColor='buttonFace';
    borderLeft='solid 1px silver';
    borderTop='solid 1px silver';
    borderRight='solid 1px gray';
    borderBottom='solid 1px gray';
    fontWeight='700';
    fontSize='13px';
    zIndex='999';
    }
    oProgressLayer.innerHTML='<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td align="center" valign="middle">'+ message +
    '<br />'+
    '<span style="border:solid 1px black;padding:1px;height:14px;margin-top:5px;">'+
    '<span style="150px;height:12px;border:none;padding:-1px;overflow:hidden;">'+
    '<marquee style="150px;" direction="right" scrollamount="10">'+
    '<span style="padding:1px;text-align:right;130px;height:10px;background-color:#0000A0;filter:Alpha(startX=0,startY=0, finishX=130, finishY=0,style=1,opacity=0,finishOpacity=100);">'+

    '</span>'+
    '</marquee>'+
    '</span>'+
    '</span>';
    document.body.appendChild(oProgressLayer);
    //SetBusy();

    document.write( oProgressLayer.outerHTML );

    }

    ////////////////


    function _GetRequestObj(){
    var req = new ActiveXObject("microsoft.xmlhttp");
    //var req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
    return req ;
    }
    //请求数据
    function AsyncLoad(  url ){

    var request = _GetRequestObj() ;
    /*
    var url = window.location.pathname */

    loader.innerHTML = ( "load ..." );

    request.onreadystatechange = function()
    {
    if(request.readyState == 4){
     document.write( request.responseText );
    }
    }

    request.open( "GET", url , true );
    request.send();
    }
     


    页面包含以上js本.

    然后;
    <form onsubmit="ShowProgressInfo1('loading')">

  • 相关阅读:
    平均要取多少个(0,1)中的随机数才能让和超过1
    perl学习笔记
    K-means
    Mysql数据库常用操作整理
    ETL模型设计
    c++ 面试整理
    vim display line number
    inux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件的作用
    Linux命令大总结
    perl learning
  • 原文地址:https://www.cnblogs.com/winner/p/887523.html
Copyright © 2020-2023  润新知