$(function(){ /* 滚轮 */ var myScroll = new IScroll(".iscroll",{ scrollbars: true, fadeScrollbars:true, scrollbars: 'custom', shrinkScrollbars:'clip', tap:true }); setTimeout(function () { myScroll.refresh(); }, 100); var theme="android-ics"; $("#date").mobiscroll().date({ lang: "zh",//显示中文 theme: theme,//主题 setText: '确定',//确认按钮名称 cancelText: '取消',//取消按钮名称 dateFormat: 'yy-mm-dd',// 日期格式 dateOrder: 'yymmdd',//面板中日期排列格式 display: 'bottom',//显示方式 endYear:2050,//结束年份 }); //日期不能修改 if ($("#id").val() != "" && $("#id").val() != "0"){ $("#date" ).prop("disabled" , true); } $("#eph").bind("click", function() { var id = $("#id").val(); if (id == "") { haifmp.loadMobilePage("haifmp", "getZzdsSearchDweb.htm?mcid=" + $("#mcid").val()); } }); //点击input键盘弹出滚动区域translateY往上滚动; $(document).ready(function () { var clickQian = document.body.clientHeight; var switcha = true; var a = null; $("input[type='number']").on("tap",function(){ a = $(".content")[0].style.transform.split(',')[1].split(' ')[1].match(/\d+(\.\d+)?/)[0]; if($("input[type='number']") && switcha){ setTimeout(function(){ var clickHou = document.body.clientHeight; var zimujpHeight = clickQian - clickHou - a - 280 + "px"; $(".content")[0].style.transform = "translateY(-"+zimujpHeight+")"; myScroll.refresh(); switcha = false; },250); } }); }); //元素失去焦点隐藏软键盘 $("#zzdsForm").on("tap",function(e){ if(e.target.nodeName != "INPUT"){ $('input').blur(); }; }); }); /** * 保存 * @param type */ function saveZzds(type) { if (dweb == "") { alert("请输入正确的耳标号!"); return false; } else { jQuery('#zzdsForm').ajaxSubmit({ dataType : 'json', data : {"mcid" : $("#mcid").val()}, beforeSend:function() { //触发ajax请求开始时执行 if(type==1){ $(".sub").text("提交中……"); $('.sub').attr('onclick','javascript:void(0)');//改变提交按钮上的文字并将按钮设置为不可点击 }else{ $(".subAdd").text("提交中……"); $('.subAdd').attr('onclick','javascript:void(0)');//改变提交按钮上的文字并将按钮设置为不可点击 } }, success : function(msg, data) { // 保存成功 if (msg.result=1) { alert("保存成功!"); if (type == "1") { haifmp.loadMobilePage("haifmp", "hpSjlrSlwlIndex.htm?mcid=" + $("#mcid").val()); } else { haifmp.loadMobilePage("haifmp", "hpSjlrSlwlAdd.htm?mcid=" + $("#mcid").val()); } }else{ if (type == "1") { alert(msg.msg); $('.sub').text('提交表单'); $('.sub').attr('onclick','submitorder()');//改变提交按钮上的文字并将按钮设置为可点击 } else { alert(msg.msg); $('.subAdd').text('提交表单'); $('.subAdd').attr('onclick','submitorder()');//改变提交按钮上的文字并将按钮设置为可点击 } } }, error : function(data) { if(type=="1") { alert('网络繁忙,请稍后再试...'); $('.sub').text('保存'); $('.sub').attr('onclick','submitorder()');//改变提交按钮上的文字并将按钮设置为可点击 }else { alert('网络繁忙,请稍后再试...'); $('.subAdd').text('保存并新增'); $('.subAdd').attr('onclick','submitorder()');//改变提交按钮上的文字并将按钮设置为可点击 } }, complete: function(msg, data) { //ajax请求完成时执行 if(msg.result==1) { if(type==1){ $(".sub").text("提交中……"); $('.sub').attr('onclick','javascript:void(0)');//改变提交按钮上的文字并将按钮设置为不可点击 }else{ $(".subAdd").text("提交中……"); $('.subAdd').attr('onclick','javascript:void(0)');//改变提交按钮上的文字并将按钮设置为不可点击 } } } }); } } /** * 返回 */ function backUrl() { haifmp.loadMobilePage("haifmp", "hpSjlrDszzwhIndex.htm?mcid=" + $("#mcid").val()); }