在HTML加上
alert.js内容
window.alert = function(txt)
{
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "0px";
shield.style.top = "0px";
shield.style.width = "1003px";
shield.style.height = document.body.scrollHeight+"px";
//shield.style.background = "#000000";
shield.style.textAlign = "center";
shield.style.zIndex = "10000";
//shield.style.filter = "alpha(opacity=6)";
var alertFram = document.createElement("DIV");
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.zIndex = "10001";
alertFram.style.left="310px";
alertFram.style.top="170px";
strHtml=""
strHtml+='
'
strHtml+='
'
strHtml+=' '
strHtml+=' | '
strHtml+=' 中国DJ171音乐娱乐网 WWW.DMC.CN | '
strHtml+=' ' strHtml+=' '
strHtml+=' | '
strHtml+=' | '
strHtml+='
'
strHtml+=' '
strHtml+=' | '
strHtml+=' '+txt+' | '
strHtml+=' | '
strHtml+='
'
strHtml+=' '
strHtml+=' | '
strHtml+=' | '
strHtml+=' | '
strHtml+='
'
strHtml+='
'
strHtml+='
'
alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
document.body.appendChild(shield);
var c = 0;
this.doAlpha = function(){
if (c++ > 20){clearInterval(ad);return 0;}
shield.style.filter = "alpha(opacity="+c+");";
}
this.remove=function(){
alertFram.innerHTML="";
shield.style.filter = "";
shield.id = "";
shield.style.position = "";
shield.style.left = "";
shield.style.top = "";
shield.style.width = "";
shield.style.height ="";
shield.style.background = "";
shield.style.textAlign = "";
shield.style.zIndex = "";
shield.style.filter = "";
alertFram.id="";
alertFram.style.position = "";
alertFram.style.left = "";
alertFram.style.top = "";
alertFram.style.marginLeft = "";
alertFram.style.marginTop = "";
alertFram.style.width = "";
alertFram.style.height = "";
alertFram.style.background = "";
alertFram.style.textAlign = "";
alertFram.style.lineHeight = "";
alertFram.style.zIndex = "";
document.body.onselectstart = function(){return true;};
}
var ad = setInterval("doAlpha()",5);
alertFram.focus();
document.body.onselectstart = function(){return false;};
}
var object = null;
var newobject = null;
var element = null;
var moveX, moveY;
document.onmousemove = mousemove;
document.onmouseup = mouseup;
/* 鼠标托动 */
function mousedown(para)
{
object = document.getElementById(para);
moveX = object.style.pixelLeft - event.clientX;
moveY = object.style.pixelTop - event.clientY;
}
/* 开始托动 */
function mousemove()
{
if(object != null){
object.style.left = moveX + event.clientX;
object.style.top = moveY + event.clientY;
event.returnValue = false;
}
}
/* 释放对象 */
function mouseup()
{
if(object != null){
object = null;
}
if(newobject != null){
newobject = null;
}
}
/* 改变大小 */
function cursordown(para)
{
newobject = document.getElementById(para);
}
/* 开始改变 */
function cursormove()
{
var xMinWidth = 10, xMinHeight = 30;
var xWidth = 0, xHeight = 0;
if(newobject != null){
xWidth = Math.max(xMinWidth, event.clientX - newobject.style.left.replace('px',''));
xHeight = Math.max(xMinHeight, event.clientY - newobject.style.top.replace('px',''));
newobject.style.width = xWidth + xMinWidth + 'px';
newobject.style.height = xHeight - xMinHeight + 'px';
event.returnValue = false;