概述
复制代码 代码如下:
/********************
** js 蒙版进度条(图片)
** dingzh@jstrd.com
** 2009-12-03
*********************/
//禁止网页后退
window.history.forward(1);
document.attachEvent("onkeydown",docKeyDown);
function docKeyDown() {
//屏蔽退格删除键
if (window.event.keyCode == 8) {
if(window.event.srcElement.type != "text"
&& window.event.srcElement.type != "textarea"
&& window.event.srcElement.type != "password") {
window.event.keyCode = 0x0;
return false;
} else if(window.event.srcElement.readOnly) {
window.event.keyCode = 0x0;
return false;
}
}
}
//加载进度条
var process_submit_doing = false;
try {
window.attachEvent("onload",doBodyLoad);
//document.attachEvent("onclick",doProcess);
window.attachEvent("onbeforeunload",doWinLoad);
} catch(e) {
document.addEventListener("onclick",doProcess,false);
window.addEventListener("onbeforeunload",doWinLoad,false);
}
//
function doBodyLoad() {
var obj;
var vInput=document.getElementsByTagName("INPUT");
for(var i in vInput) {
obj=vInput[i];
if(obj.type=="button" || obj.type=="submit") {
obj.attachEvent("onclick",doProcess);
}
}
vInput=document.getElementsByTagName("IMG");
for(var i in vInput) {
obj=vInput[i];
if(undefined != obj.alt) {
obj.attachEvent("onclick",doProcess);
}
}
}
//
function doWinLoad() {
process_submit_doing = true;
}
//
function doProcess() {
//是否正在提交
if(!process_submit_doing) {
return;
}
//
var showProcess = false;
//捕获事件源
var eventObj = event.srcElement;
var btnvalue = "";
if(eventObj.tagName=='INPUT') {
btnvalue = eventObj.value;
} else if(eventObj.tagName=='IMG') {
if(null != eventObj.alt && "" != eventObj.alt) {
btnvalue = eventObj.alt;
} else {
btnvalue = eventObj.title;
}
}
btnvalue = btnvalue.replace(/ */g,"").replace(/ */g,"");
//
var my_array = new Array();
my_array.unshift("提交", "确定", "保存", "暂存", "结账", "审核", "审批", "作废", "回退", "退回", "驳回",
"退单", "撤消", "导入", "受理", "办理", "处理", "查询", "入库", "入账", "出库", "出账");
for (i = 0; i < my_array.length; i++) {
if(new RegExp(my_array[i],"ig").test(btnvalue)) {
showProcess = true;
break;
}
}
//alert(showProcess);
//不显示进度条
if(!showProcess) {
return;
}
//
createProcessBgDiv();
}
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick()
{
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
//页面蒙版
function createProcessBgDiv()
{
var h=document.body.scrollHeight;
var w=document.body.scrollWidth;
var div=document.createElement("<div id='divProcessBg' style='position:absolute;visibility:visible;background:gray;filter:alpha(opacity=30);z-index:1000;left:0;top:0;width:"+w+"px;height:"+h+"px;'></div>");
//div.appendChild(document.createTextNode("xxxxxxxxxxxxxxxxxxxx"));
div.appendChild(document.createElement("<iframe src='javascript:false' style='position:absolute; visibility:inherit; top:0px; left:0px; width:"+w+"px;height:"+h+"px; z-index:-1; filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";'></iframe>"));
document.body.appendChild(div);
document.body.appendChild(document.createElement("<div style='position:absolute;z-index:1002;left:0;top:0;width:"+w+"px;height:"+h+"px;background:url(/upload/2010-3/20100310161010599.gif) no-repeat center center;'></div>"));
//屏蔽鼠标右键
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
}
/*function delProcessBgDiv()
{
document.body.removeChild(document.getElementById("divProcessBg"));
document.onmousedown = null;
} */
最后
以上就是活泼花卷为你收集整理的js 蒙版进度条(结合图片)的全部内容,希望文章能够帮你解决js 蒙版进度条(结合图片)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复