1.IE7中绝对定位元素之间的遮盖问题
设置父元素z-index,大于父元素的兄弟元素的z-index
2.IE7子级不随滚动条滚动,IE7也没有修改这个BUG
解决方案:父级元素添加 "position:relative;left:0;top:0;"
3.获取验证码
/*
* @Author: zhangye
* @Date: 2018-04-20 11:43:26
* @Version: 1.0
* @Last Modified by: gitshilly
* @Last Modified time: 2018-04-25 11:07:42
*/
;
$(function() {
var _urlpre = "url";
var _globl = {
tid: QueryString("tid"),
sid: QueryString("sid"),
id: QueryString("id"),
scripts: _urlpre + "PCodeById",
yzmurl: _urlpre + "SendCodeAll",
saveUserInfo: _urlpre + "SavePotentialUserAll"
};
// 内容区域
var $container = $('[data-container]').length ? $('[data-container]') : $(document.body);
// 主窗口
var $pop = $('[data-pop]', $container);
// 错误提示弹窗
var $errMsgPop = $('[data-popalert]', $container);
// 正确提示弹窗
var $resultPop = $('[data-result]', $container);
// 已提交提示弹窗
var $resultPop2 = $('[data-wait]', $container);
var $tel = $("[data-tel]", $container);
var $yzm = $('[data-yzm]', $container);
var yzmDefault = $yzm.val();
// 如果没有对象,直接中断
if (!$tel.length || !$yzm.length) { return false; }
// 引用加密js
var sc = document.getElementsByTagName('script')[0];
var _script = document['createElement']('script');
_script.type = 'text/javascript';
_script.async = true;
_script.src = 'http://act2017.emoney.cn/Scripts/rasall.js';
sc.parentNode.insertBefore(_script, sc);
// 取消错误信息弹窗关闭按钮事件
$('.close', $errMsgPop).unbind();
$errMsgPop.on('click', '.close', function(event) {
event.preventDefault();
/* Act on the event */
$('[data-btn]', $errMsgPop).trigger('click');
});
// 重新输入,弹窗输出
$errMsgPop.on('click', '[data-btn]', function(event) {
event.preventDefault();
/* Act on the event */
$errMsgPop.hide();
$pop.show();
});
// 发送验证码,倒计时
$container.on('click', '[data-send]', function(event) {
event.preventDefault();
/* Act on the event */
if (!validateTel()) {
return false;
}
Countdown($(this));
$.ajax({
url: _globl.yzmurl,
type: 'POST',
dataType: 'json',
data: { phonenum: do_encrypt($.trim($tel.val())) },
})
.done(function(data) {
console.log(data.status);
})
.fail(function() {
popAlert("发送错误,请重试");
});
});
// 确认领取
$container.on('click', '[data-ok]', function(event) {
event.preventDefault();
/* Act on the event */
// 手机验证
if (!validateTel()) {
return false;
}
// 验证码为空验证
if (!$.trim($yzm.val()) || $.trim(yzmDefault) == $.trim($yzm.val())) {
popAlert("抱歉,验证码不能为空");
return false;
}
Send($.trim($tel.val()), $.trim($yzm.val()));
});
var seconds = 60;
var timer;
function Countdown($this) {
if (seconds == 0) {
$($this).html('获取验证码');
$($this).prop('disabled', false);
clearTimeout(timer);
seconds = 60;
} else {
seconds -= 1;
$($this).prop('disabled', true);
$($this).html(seconds + 'S');
timer = setTimeout(function() { Countdown($($this)); }, 1000);
}
}
// 手机验证
function validateTel() {
var telReg = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/g;
if (!$.trim($tel.val()) || !telReg.test($tel.val())) {
popAlert("抱歉,手机号码格式有误!");
return false;
}
return true;
}
// 错误信息提示
function popAlert(msg) {
$('[data-errorMeg]', $errMsgPop).html(msg);
$errMsgPop.show();
$pop.hide();
}
// 确认领取 request
function Send(tel, yzm) {
$.ajax({
url: _globl.saveUserInfo,
// xhrField:{
// withCredentials:true
// },
// crossDomain: true,
type: 'GET',
dataType: 'json',
data: {
phonenum: do_encrypt($.trim($tel.val())),
code: yzm,
url: window.location.href,
tid: _globl.tid,
sid: _globl.sid
}
})
.done(function(data) {
if (data.status == "1") {
$resultPop.show();
$pop.hide();
}else if(data.status == "5"){
$resultPop2.show();
$pop.hide();
} else {
popAlert(data.msg);
}
})
.fail(function() {
popAlert("发送错误,请重试");
});
}
//rsa加密
function do_encrypt(str) {
var before = new Date();
var rsa = new RSAKey();
var key = "010001";
var public_key = "96483cb253ae62ffb8bbc3cd5f8fbf4bd3d51ebb32c992bd7649a371bf83ed649cdd3d18f4ea7405438d7393c0c38c0daf5032df5d744e6c189be918fbf937d261e78ef807e173c41dedb7bafb4c72fe00cbc7a677e87e8d972512810a897fd31c8dde1f6607d708ed3e764d35a85a51767d4005ec6935e9c597b397ef46844b";
var res;
rsa.setPublic(public_key, key);
res = rsa.encrypt(str);
var after = new Date();
if (res) {
return linebrk(hex2b64(res), 64);
} else {
return "";
}
}
function QueryString(param) {
var _str = window.location.search && window.location.search.substr(1);
var jsontemp = {};
_str.replace(/([^?&=]+)=([^?&=]*)/g, function(r, $1, $2) {
jsontemp[$1] = encodeURIComponent($2);
});
return jsontemp[param];
}
});