以下是js代码:
window.alert=function(txt)
{
var shield = top.window.document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "0px";
shield.style.top = "0px";
shield.style.width = "100%";
shield.style.height =top.window.document.body.scrollHeight+"px";
shield.style.background = "#333";
shield.style.textAlign = "center";
shield.style.zIndex = "10000";
shield.style.filter = "alpha(opacity=0)";
var alertFram = top.window.document.createElement("DIV");
alertFram.className="dragAble";
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.left = "600px";
alertFram.style.top = "400px";
alertFram.style.marginLeft = "-225px";
alertFram.style.marginTop = "-75px";
alertFram.style.width = "200px";
alertFram.style.height = "auto";
alertFram.style.background = "white";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "150px";
alertFram.style.zIndex = "10001";
strHtml="<ul style=\"list-style:none;margin:0px;padding:0px;width:100%;height:auto;border:3px solid #1567ea;border-top:0px solid #1567ea\">\n";
strHtml+="<li style=\"position: relative ;background-image: url(d-x3.gif);background-repeat:repeat-x;text-align:left;padding-left:10px;font-size:14px;font-weight:bold;height:25px;line-height:25px;\"><div style=\"cursor:default;font:Calibri;color:white;\">Warning</div></li>\n";
strHtml+="<li style=\"background:#fff;text-align:center;font-size:12px;height:auto;line-height:30px;\"><div style=\"cursor:default\">"+txt+"</div></li>\n";
strHtml+="<li style=\"background:#f5f5f5;text-align:center;font-weight:bold;height:25px;line-height:25px; border-top:1px solid #f5f5f5;\"><input type=\"button\" class=\"sbutton\" onMouseOver=\"this.className='button'\" onMouseOut=\"this.className='sbutton'\" value=\"Close\" onclick=\"doOk()\" /></li>\n";
strHtml+="</ul>\n";
alertFram.innerHTML = strHtml;
top.window.document.body.appendChild(alertFram);
top.window.document.body.appendChild(shield);
var c = 0;
top.window.doAlpha = function(){
if (c++>20){self.window.clearInterval(ad);return 0;}
shield.style.filter = "alpha(opacity=1);";
}
var ad=self.window.setInterval("parent.doAlpha()",5);
top.window.doOk=function(){
alertFram.style.display ="none";
shield.style.display ="none";
}
alertFram.focus();
top.window.document.body.onselectstart = function(){return false;};
}
var ie= top.window.document.all;
var nn6= top.window.document.getElementById&&!top.window.document.all;
var isdrag=false;
var y,x;
var oDragObj;
function moveMouse(e) {
if (isdrag) {
oDragObj.style.top = (nn6 ? nTY + top.window.e.clientY - y : nTY + top.window.event.clientY - y)+"px";
oDragObj.style.left = (nn6 ? nTX + top.window.e.clientX - x : nTX + top.window.event.clientX - x)+"px";
return false;
}
}
function initDrag(e) {
var oDragHandle = nn6 ? top.window.e.target :top.window.event.srcElement;
var topElement = "HTML";
while (oDragHandle.tagName != topElement && oDragHandle.className != "dragAble") {
oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
}
if (oDragHandle.className=="dragAble") {
isdrag = true;
oDragObj = oDragHandle;
nTY = parseInt(oDragObj.style.top+0);
y = nn6 ? top.window.e.clientY : top.window.event.clientY;
nTX = parseInt(oDragObj.style.left+0);
x = nn6 ? top.window.e.clientX : top.window.event.clientX;
top.window.document.onmousemove=moveMouse;
return false;
}
}
top.window.document.onmousedown=initDrag;
top.window.document.onmouseup=new Function("isdrag=false");
//-->
将此代码保持为js文件然后导入html中即可
下载为所需的图片
我现在的毛病是将两个连着的alter 同时写就不行了
比如 alter(1)
alter(2)
希望大家帮我解决啊!!!谢谢啦
- 大小: 200 Bytes
- 大小: 1.3 KB
- 大小: 327 Bytes
分享到:
相关推荐
重写window.alert方法 重写window.alert方法
javascript中window.confirm这个方法很好用,可以弹出一个确认对话框我们之所以弹出这个对话框,可能就是因为该操作很危险,所以要用户确认。但如果默认选择”确定”,则可能违背了这个原则。 另外,confirm对话框的...
jquery alert 信息提示 精通JavaScript+jQuery
10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法的重写.zip10.java方法...
已经在 IE8 , firefox3.0.11下面测试通过 代码如下: $.extend({ includePath: ”, include: function(file) { var files = typeof file == “string” ? [file] : file; for (var i = 0; i <...
重写js的alert方法.html文件。拿来既可以用
url重写说明.doc url重写说明.doc
重写window对象的方法不是一件新奇的事,比如我们可能需要改变默认alert的行为,如何安全的重写呢? 小菜看到某知名IT网站是这样的写法: 代码如下: window.alert = function(){}; 或者 代码如下: alert = ...
js重写alert和confirm,alert使用方法未改变,只要引用次js即可改变以往的alert效果
url重写web.config文件url重写web.config文件
行业分类-设备装置-DRAM电路、冗余重写电路及重写方法.zip
对非网页弹出窗口,如window.alert,window.confirm,window.prompt,window. showModalDialog等,有如下方法: 1.封装Windows Api,对Java语言则有Java Native Interface (JNI)或者J/Invoke(示例)。 2....
javascript重写alert方法的实例代码.docx
重写API.exe
python继承类重写方法 Python是一种面向对象的编程语言,它支持继承类重写方法。继承是一种重要的面向对象编程概念,它允许我们创建一个新类,该类继承了另一个类的属性和方法。重写方法是指在子类中重新定义父类中...
CSS样式重写.cssCSS样式重写.cssCSS样式重写.cssCSS样式重写.cssCSS样式重写.cssCSS样式重写.css
UrlRewritingNet(URL重写).rar
NULL 博文链接:https://hugang357.iteye.com/blog/761620