【转】js模拟信息提示
转自:http://hi.baidu.com/pao8041/blog/item/1ad116f71feca520730eecd7.html
<html>
<head>
<title>模拟信息提示</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
var ScreenW;
var ScreenH;
function GetScreen() {
ScreenW = window.screen.Width;
ScreenH = window.screen.Height;
}
function window.onload() {
GetScreen();
window.setTimeout("HideDiv()",1000);
}
var flag = false;
function HideDiv() {
if(flag == true) {
Layer1.style.left = 0;
Layer1.style.top = 0;
Layer1.style.height = 0;
Layer1.style.visibility="hidden";
flag = false;
}
else {
Layer1.style.left = eval( ScreenW/2 - 200 );
Layer1.style.top = eval( ScreenH/2 - 150 );
Layer1.style.width = 300;
Layer1.style.height = 100;
Layer1.style.visibility="visible";
flag = true;
}
window.setTimeout("HideDiv()",5000);
}
//**************************************************************
var x=0,y=0;
var set;
function GetCoord()
{
set = true;
event.srcElement.setCapture();
x = document.all("Layer1").style.pixelLeft - event.x;
y = document.all("Layer1").style.pixelTop - event.y;
}
function document.onmousemove()
{
if(set == true){
var X = event.x;
var Y = event.y;
if( X < 0 )
X = 10;
if( X > ScreenW )
X = ScreenW - 10;
if( Y < 0 )
Y = 0;
if( Y > ScreenH )
Y = ScreenH - 10;
document.all("Layer1").style.pixelLeft = X + x;
document.all("Layer1").style.pixelTop = Y + y;
}
}
function document.onmouseup() {
set = false;
event.srcElement.releaseCapture();
}
//**************************************************************
function Compare() {
var strWin = "dialogHeight: 100px; dialogWidth: 300px; dialogTop: 363px; ";
strWin += "dialogLeft: 500px; edge: Raised; center: Yes; help: No; resizable: ";
strWin += "Yes; status: No;";
window.showModalDialog("表格行选择2.html","Dialog Arguments Value",strWin);
}
</script>
</head>
<body bgcolor="#FFFFFF">
<a href="#" ondblclick="Compare()">双击</a>
<div id="Layer1" style="position:absolute; width:300px; height:100px; z-index:1;">
<table width="100%" border="1" cellspacing="0" cellpadding="0" name="MessTable" height="100%" align="center">
<tr align="center" valign="middle" bgcolor="#E8E0D2">
<td style="border-Bottom:#999999 1px solid;border-Left:#999999 1px solid;border-Right:#999999 1px solid;border-Top:#ffffff 1px solid;CURSOR: move;" onselectstart="return false" oncontextmenu="javascript:window.event.returnValue=false" onmousedown="GetCoord()" height="18" background="top_style.gif" align="left"><font size="3" color="#FFFFFF" face="Fixedsys">这是标题 </font> </td>
</tr>
<tr align="center" valign="middle" bgcolor="#E8E0D2" bordercolor="#FFFFFF">
<td style="border-Bottom:#999999 1px solid;border-Left:#ffffff 1px solid;border-Right:#999999 1px solid;border-Top:#ffffff 1px solid;CURSOR: default;" onselectstart="return false" oncontextmenu="javascript:window.event.returnValue=false"><font size="3">系统处理中,请稍候
</font></td>
</tr>
</table>
</div>
</body>
</html>
<head>
<title>模拟信息提示</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
var ScreenW;
var ScreenH;
function GetScreen() {
ScreenW = window.screen.Width;
ScreenH = window.screen.Height;
}
function window.onload() {
GetScreen();
window.setTimeout("HideDiv()",1000);
}
var flag = false;
function HideDiv() {
if(flag == true) {
Layer1.style.left = 0;
Layer1.style.top = 0;
Layer1.style.height = 0;
Layer1.style.visibility="hidden";
flag = false;
}
else {
Layer1.style.left = eval( ScreenW/2 - 200 );
Layer1.style.top = eval( ScreenH/2 - 150 );
Layer1.style.width = 300;
Layer1.style.height = 100;
Layer1.style.visibility="visible";
flag = true;
}
window.setTimeout("HideDiv()",5000);
}
//**************************************************************
var x=0,y=0;
var set;
function GetCoord()
{
set = true;
event.srcElement.setCapture();
x = document.all("Layer1").style.pixelLeft - event.x;
y = document.all("Layer1").style.pixelTop - event.y;
}
function document.onmousemove()
{
if(set == true){
var X = event.x;
var Y = event.y;
if( X < 0 )
X = 10;
if( X > ScreenW )
X = ScreenW - 10;
if( Y < 0 )
Y = 0;
if( Y > ScreenH )
Y = ScreenH - 10;
document.all("Layer1").style.pixelLeft = X + x;
document.all("Layer1").style.pixelTop = Y + y;
}
}
function document.onmouseup() {
set = false;
event.srcElement.releaseCapture();
}
//**************************************************************
function Compare() {
var strWin = "dialogHeight: 100px; dialogWidth: 300px; dialogTop: 363px; ";
strWin += "dialogLeft: 500px; edge: Raised; center: Yes; help: No; resizable: ";
strWin += "Yes; status: No;";
window.showModalDialog("表格行选择2.html","Dialog Arguments Value",strWin);
}
</script>
</head>
<body bgcolor="#FFFFFF">
<a href="#" ondblclick="Compare()">双击</a>
<div id="Layer1" style="position:absolute; width:300px; height:100px; z-index:1;">
<table width="100%" border="1" cellspacing="0" cellpadding="0" name="MessTable" height="100%" align="center">
<tr align="center" valign="middle" bgcolor="#E8E0D2">
<td style="border-Bottom:#999999 1px solid;border-Left:#999999 1px solid;border-Right:#999999 1px solid;border-Top:#ffffff 1px solid;CURSOR: move;" onselectstart="return false" oncontextmenu="javascript:window.event.returnValue=false" onmousedown="GetCoord()" height="18" background="top_style.gif" align="left"><font size="3" color="#FFFFFF" face="Fixedsys">这是标题 </font> </td>
</tr>
<tr align="center" valign="middle" bgcolor="#E8E0D2" bordercolor="#FFFFFF">
<td style="border-Bottom:#999999 1px solid;border-Left:#ffffff 1px solid;border-Right:#999999 1px solid;border-Top:#ffffff 1px solid;CURSOR: default;" onselectstart="return false" oncontextmenu="javascript:window.event.returnValue=false"><font size="3">系统处理中,请稍候
</font></td></tr>
</table>
</div>
</body>
</html>
本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights.
浙公网安备 33010602011771号