本文主要是介绍纯JS弹窗,没考虑兼容性,重用性,顺手写的,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
var bool = false;
//@author lichaoyong
function changeblance(ele,id){
// 创建文本内容节点
var p1 = document.createElement('p');
var p2 = document.createElement('p');
var p3 = document.createElement('p');
var div4 = document.createElement('div');
var lable1 = document.createElement('lable');
var lable2 = document.createElement('lable');
var input1 = document.createElement('input');
var input2 = document.createElement('input');
var input3 = document.createElement('input');
var span = document.createElement('span');
var lable5 = document.createElement('lable');
if(bool){
return false;
}
var div = document.createElement("div");
lable1.innerText = '当前总金额';
input1.style.readonly = "readonly"
lable2.innerText = '走飞 金额';
input1.size = 8;
input2.size = 8;
var regExp = /<font.*>(.*)<\/font>/ig;
//exec返回一个数组对象
var arr = arrTmp[4].match(regExp);
// alert(arr);
// alert(RegExp.$1);
//var str = arrTmp[4];
// var nodee = eval(str);
input1.value = RegExp.$1;
input2.value = '0';
input3.type="button";
input3.value = '点击';
input3.οnclick=function(){
if(parseInt(input1.value) < parseInt(input2.value) || parseInt(input2.value) < 0 ){
alert('走飞金额必须小于当前总金额');
return false;
}
var val = input1.value - input2.value;
var str = sendCommand('a','set1.php','id='+id+'&val='+val);
div.style.display = "none";
bool = false;
location.reload();
}; //绑定点击事件
var obj = ele;
div.id = "dig";
div.style.background = "#DDDDDD";
div.style.width = 200;
div.style.height = 150;
div.style.top = document.body.clientHeight/2;
div.style.left = document.body.clientWidth/2;
div.style.position = "absolute";
div.style.display = 'block';
span.innerHTML = "x";
span.style.width = 20;
span.style.float = "right";
div4.appendChild(span);
lable5.innerText = "更改走飞金额";
div4.style.background = "#0077CC";
div4.appendChild(lable5);
span.onclick = function(){ //x关闭本窗口
div.style.display = "none";
bool = false;
}
div.appendChild(div4);
var pnode1 = div.appendChild(p1);
pnode1.appendChild(lable1);
pnode1.appendChild(input1);
var pnode2 = div.appendChild(p2);
pnode2.appendChild(lable2);
pnode2.appendChild(input2);
var pnode3 = div.appendChild(p3);
pnode3.appendChild(input3);
div.style.zIndex = 100;
window.domain = 'www.api.test.com';
window.document.body.appendChild(div);
bool = true;
}
这篇关于纯JS弹窗,没考虑兼容性,重用性,顺手写的的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!