Defry

博客园 首页 新随笔 联系 订阅 管理

//父页面点查询,子页面显示
function query() {
 setElementValue(null, "method", "queryP2pPaySalaryPlanInfor");
 setElementValue(null, "currPage", 1);
 document.forms[0].target = "frame1";
 document.forms[0].submit();
}

function queryP2pYQAppInfo() {
  setElementValue(null,"method","queryP2pBranchRedFlagInfo");    
  document.forms[0].target = "frame1";  
  document.forms[0].submit();
 }
//新增
function add() {
   window.location.href = "${pageContext.request.contextPath}/p2pReceptionInfoAction.do?method=mainP2pReceptionInfoInit&flag=1";
}
function load() {
   var userLevel = "${userLevel }";
   if (userLevel == '2') {
      document.getElementById("add").style.display = "none";
   }
}

//设置下拉列表选中

function loadselect(){
     //接待信息回显
     selected("isBdhj","${p2pReceptionInfo.isBdhj}");

}

//显示与隐藏

var status = document.forms[0].status.value;  //审批结果

document.getElementById('reTr').style.display = 'block';

document.getElementById('reTr').style.display = 'none';

 

//通过Forms获取值,及手机号

var urgentMemberTel1=document.forms[0].urgentMemberTel1;
   if(isNaN(familyMemberTel1.value) || familyMemberTel1.value.length>11){
      alert("电话号码/手机号为11位以内的数字!")
      familyMemberTel1.focus();
      return true;
   }

//自动失去焦点

 onFocus="this.blur()"

//事件绑定多个处理

程序中给一个事件指派多个处理过程的话,只要首先判断一下浏览器,然后根据不同的浏览器,选择使用 attachEvent 还是 addEventListener 就可以了。实例如下:

 if (window.attachEvent) {                 

  window.attachEvent("onload", remove);             

} else if (window.addEventListener) {                 

   window.addEventListener("load", remove, false);               

}                         

function remove() {                 

  var div = document.getElementById("divprogressbar");            

      document.body.removeChild(div);             

 

//去除文本域空格

<html:text property="loanName" onblur="this.value=removeAllBlanks(loanName.value)"></html:text>

function removeAllBlanks(str){
 var result;
 result = str.replace(/(^\s+)|(\s+$)/g,"");
 result = result.replace(/\s/g,"");
 return result;
}

//日历控件使用

1、引入popcalendar.js

2、<html:text property="idCardEexpire" readonly="true"></html:text>
       <img src="${pageContext.request.contextPath}/images/main/time.gif"
   width="16" height="16" style="width: 16; height: 16; border: 0; cursor: hand"
   onClick="popUpCalendar(this,document.forms[0].idCardEexpire,'yyyy-mm-dd');">

 

//返回到指定路径

function back(){
 window.navigate("${pageContext.request.contextPath}/p2pLoanIdcardInfoNewAction.do?method=queryIdcardInfoInitNew");
  }

history.back(-1):直接返回当前页的上一页,数据全部消息,是个新页面

history.go(-1):也是返回当前页的上一页,不过表单里的数据全部还在

返回到指定连接:document.location.href= "${pageContext.request.contextPath}"+returnUrl;

history.back(0) 刷新 history.back(1) 前进 history.back(-1) 后退

//通过Form id获取其下子元素的值

var loanName=document.forms["myForm"].loanName.value;//姓名 form 的ID

//通过all获取值

<html:text property="idCard" onblur="getBrithday()" maxlength="18"></html:text>

document.all("idCard").value

 //按键触发 

document.onkeydown = onQuery;
   function onQuery(){
    if(event.keyCode == 13){
     submitForm();
    }
   }
  
   function submitForm() {

   document.forms[0].submit();

}

//滤镜  遮罩效果

function ReadCard_onclick() { 
  var htmStr = "<div id='wait' style='display: block;position:absolute;left:10px;top:10px;width:99%;height:45%;background-color:#777;font-size:14px;font-weight:bold;padding-top:15px;letter-spacing:2pt;text-align:center;filter:alpha(opacity=90)'>正在读取信息,请稍候...</div>"
    $("#result").before(htmStr);
    setTimeout('readCard()',1000);
 }

<body>

<object classid="clsid:5EB842AE-5C49-4FD8-8CE9-77D4AF9FD4FF" id="IdrControl1" width="0" height="0" codebase="idr.cab"></object>

</body>
 function readCard(){
  try { 
      var ax = new ActiveXObject("IDRCONTROL.IdrControlCtrl.1"); 
  } catch(e) { 
      alert("控件未安装"); 
  }   
  //注意:第一个参数为对应的设备端口,USB型为1001,串口型为1至16
  var result=IdrControl1.ReadCard("1001","");
  if(result == 1) {
   $("#wait").remove();
   document.all("loanName").value = IdrControl1.GetName();
     document.all("gender").value = IdrControl1.GetSexN();

}

 

//获取通过name值获取页面内容、并页面加载完毕后自动执行js函数

<html> <head>
<script>
x = 0;
function
countSecond( )
{ 

  x = x+1
  document.fm.displayBox.value=x;

  setTimeout("countSecond()", 1000)
}
</script> </head>
<body bgcolor=lightcyan text=red> <p> </br>
<form name=fm>
<input type="text" name="displayBox"value="0" size=4 >
</form>
<script>
countSecond( );//自动执行
</script>
</body> </html>

 document.all("nationName").value = naName;

 

posted on 2015-05-25 10:47  Defry  阅读(326)  评论(0编辑  收藏  举报