<html>
<head>dd</head>
<script language="javascript">
var obj1,obj2,obj3,obj4
function Myalert(){
obj1=document.createElement('<div id="a" style="position:absolute;filter:alpha(opacity=50);background-color:#cccccc;top:0px;left:0px;width:100%;height:100%;z-index:1000"></div>');
str='<div align="center" id="b" style="filter:alpha(opacity=100);position:absolute;z-index:1001;top:300px;left:300px;width:300px;height:100px;background-color:#ffffff;"></div>';
obj2=document.createElement(str);
obj3=document.createElement("<span></span>");
obj3.innerText="dfadfdsffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
obj4=document.createElement('<input type="button" value="确定" onclick="MYalertOk()">');
obj2.appendChild(obj3)
obj2.appendChild(obj4)
document.body.appendChild(obj1);
document.body.appendChild(obj2);
}
function MYalertOk(){
document.body.removeChild(obj1);
document.body.removeChild(obj2);
}
</script>
<body >
<table>
<input type="button" value="抱歉!" onclick="Myalert()">
<tr>
<td>test</td><td>test</td><td>test</td><td>test</td><td>test</td><td>test</td>
</tr>
<tr>
<td>test</td><td>test</td><td>test</td><td>test</td><td>test</td><td>test</td>
</tr>
<tr>
<td>test</td><td>test</td><td>test</td><td>test</td><td>test</td><td>test</td>
</tr>
<tr>
<td>test</td><td>test</td><td>test</td><td>test</td><td>test</td><td>test</td>
</tr>
</table>
</body>
</html>
来源:https://www.cnblogs.com/z-david/archive/2008/05/28/1209247.html