修改后的prototype.js,增加进度条和验证输入框

使用示例
None.gif < script type = " text/javascript "  src = " ../scripts/prototype.js " ></ script >
None.gif
< script type = " text/javascript " >
None.gifvar progressBar;
ExpandedBlockStart.gifContractedBlock.gif
/**/ /*
InBlock.gif* 功能:admin登录
ExpandedBlockEnd.gif
*/

None.giffunction UserLogin()
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
InBlock.gif    
//验证页面控件
InBlock.gif
    var checkform = new CheckForm();
InBlock.gif    
if(!checkform.checkForm(document.getElementById('formLogin'))) return false;    
InBlock.gif        
InBlock.gif    
//开始提交数据
InBlock.gif
    progressBar = new ProgressBar();
InBlock.gif    progressBar.SetStatus(
"正在发送数据到服务器dot.gif.");
InBlock.gif    
InBlock.gif    var url 
= "../admin.do";
InBlock.gif    var pars 
= "action=Login&username=" + $F('username'+ "&password=" + $F('password'+ "&rnd=" +$F('rnd');
InBlock.gif    var myAjax 
= new Ajax.Request(
InBlock.gif    url,
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{method: 'post', parameters: pars, onComplete: UserLogin_CallBack}
InBlock.gif    );
ExpandedBlockEnd.gif}

ExpandedBlockStart.gifContractedBlock.gif
/**/ /*
InBlock.gif* 功能:admin登录 - CallBack
ExpandedBlockEnd.gif
*/

None.giffunction UserLogin_CallBack(originalRequest)
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif  var objXml 
= originalRequest.responseXML;
InBlock.gif  
//alert(originalRequest.responseTEXT);
InBlock.gif
  try
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif    
if(objXml.getElementsByTagName("return")[0].firstChild.nodeValue == "true")
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif      progressBar.isNeedConfirmButton 
= false;
InBlock.gif      progressBar.isNeedProgressBar 
= true;
InBlock.gif      progressBar.SetStatus(
"<img src='../images/error.gif' align='absmiddle'> 登录成功,正在载入,请稍候..");
InBlock.gif
InBlock.gif      
//login success
InBlock.gif
      location.href='admin_index.htm';
ExpandedSubBlockEnd.gif    }

InBlock.gif    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif      progressBar.isNeedConfirmButton 
= true;
InBlock.gif      progressBar.isNeedProgressBar 
= false;
InBlock.gif      progressBar.focusItem 
= "username";
InBlock.gif      progressBar.SetStatus(
"<img src='../images/error.gif' align='absmiddle'> 对不起,登录失败!" + objXml.getElementsByTagName("msg")[0].firstChild.nodeValue);
InBlock.gif
InBlock.gif      $(
'btnOK').disabled = false;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif  }

InBlock.gif    
catch(err)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif      progressBar.isNeedConfirmButton 
= true;
InBlock.gif      progressBar.isNeedProgressBar 
= false;
InBlock.gif      progressBar.focusItem 
= "username";
InBlock.gif      progressBar.SetStatus(
"<img src='../images/error.gif' align='absmiddle'> 对不起,登录失败!" + err.message);
InBlock.gif
InBlock.gif      $(
'btnOK').disabled = false;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif  }

None.gif
</ script >
None.gif
None.gif
None.gif
None.gif
< table width = " 100% "  border = " 0 "  cellpadding = " 3 "  cellspacing = " 0 " >
None.gif              
< tr >
None.gif                
< td colspan = " 3 "  height = " 30 " ></ td >
None.gif              
</ tr >
None.gif              
< tr >
None.gif                
< td width = " 21% " > 用户名: </ td >
None.gif                
< td colspan = " 2 " >
None.gif                  
< input type = " text "  tabindex = " 1 "  id = " username "  name = " username "  chname = " 用户名 "  notempty = " true "  size = " 20 "  style = " width:180px; "   /></ td >
None.gif              
</ tr >
None.gif              
< tr >
None.gif                
< td > 密 码: </ td >
None.gif                
< td colspan = " 2 " >< input type = " password "  tabindex = " 2 "  id = " password "  name = " password "  chname = " 密码 "  notempty = " true "  size = " 20 "  style = " width:180px; "   /></ td >
None.gif              
</ tr >
None.gif              
< tr >
None.gif                
< td > 验证码: </ td >
None.gif                
< td colspan = " 2 " >
None.gif                  
< input type = " text "  style = " width:120px; "  id = " rnd "  tabindex = " 3 "  chname = " 验证码 "   class = " input_1 "  notempty = " true "  onKeyUp = " value=value.replace(/[^\d]/g,'') " />
None.gif                  
< img alt = " 验证码 "  src = " ../rnd.do?type=admin_rnd "  border = " 0 "  usemap = " absmiddle " /></ td >
None.gif              
</ tr >               
None.gif                
< tr >
None.gif                  
< td  class = " white " >& nbsp; </ td >
None.gif                  
< td width = " 22% " >< input type = " submit "  Class = " input_1 "  id = " btnOK "  value = " 登 录 "  tabindex = " 4 " ></ td >
None.gif                    
< td width = " 57% " >< input type = " reset "  Class = " input_1 "  value = " 重 置 " ></ td >
None.gif                
</ tr >
None.gif                
< tr >
None.gif                  
< td colspan = " 3 "  height = " 2 " ></ td >
None.gif                
</ tr >
None.gif                
< tr >
None.gif                  
< td colspan = " 3 " ></ td >
None.gif                
</ tr >
None.gif        
</ table >

prototype.js下载
posted on 2006-05-25 14:20 夜隼 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/yesun/archive/2006/05/25/408942.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值