1 倒计时
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language="JavaScript">
var deadline= new Date("08/08/2008");
var symbol="2008年8月8日";
var now = new Date();
var leave =deadline.getTime() - now.getTime();
var day = Math.floor(leave / (1000 * 60 * 60 * 24));
if (day > 0)
document.write("今天离"+ symbol+"还有"+day +"天")
else if (day == 0)
document.write("只剩最后一天")
else
document.write("已经超过了所定时间");
</script>
</head>
<body>
</body>
</html>
2 检查屏幕分辨率
<script language="JavaScript">
function getScreen()
{
if ((screen.width == 640) && (screen.height == 480))
size = "640 x 480";
else if ((screen.width == 800) && (screen.height == 600))
size = "800 x 600";
else if ((screen.width == 1024) && (screen.height == 768))
size = "1024 x 768";
else if ((screen.width == 1280) && (screen.height == 1024))
size = "1280x1024";
else
size = "默认值为640 x 480";
alert("屏幕分辨率为 " + size );
}
</script>
</head>
<body>
<input id="Button1" type="button" value="获取屏幕分辨率" onclick="getScreen()" />
3 禁止复制网页上的图片
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language="javascript">
function noCopy(control)
{
alert("版权所有,禁止复制!");
return false;
}
function check()
{
if(document.images) //遍历页面中的图像
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown = noCopy;
}
</script>
</head>
<body onload="check()">
<img src='' width=70 height=50 border=1 alt='我的图片'>
<div>
<table width="300" height="50" border="0" cellspacing="2" cellpadding="0" bgcolor="#FFb609">
<tr>
<td bgcolor="#ccffff">禁止复制网页中所有图片...</td>
</tr>
</table>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language="JavaScript">
var deadline= new Date("08/08/2008");
var symbol="2008年8月8日";
var now = new Date();
var leave =deadline.getTime() - now.getTime();
var day = Math.floor(leave / (1000 * 60 * 60 * 24));
if (day > 0)
document.write("今天离"+ symbol+"还有"+day +"天")
else if (day == 0)
document.write("只剩最后一天")
else
document.write("已经超过了所定时间");
</script>
</head>
<body>
</body>
</html>
2 检查屏幕分辨率
<script language="JavaScript">
function getScreen()
{
if ((screen.width == 640) && (screen.height == 480))
size = "640 x 480";
else if ((screen.width == 800) && (screen.height == 600))
size = "800 x 600";
else if ((screen.width == 1024) && (screen.height == 768))
size = "1024 x 768";
else if ((screen.width == 1280) && (screen.height == 1024))
size = "1280x1024";
else
size = "默认值为640 x 480";
alert("屏幕分辨率为 " + size );
}
</script>
</head>
<body>
<input id="Button1" type="button" value="获取屏幕分辨率" onclick="getScreen()" />
3 禁止复制网页上的图片
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language="javascript">
function noCopy(control)
{
alert("版权所有,禁止复制!");
return false;
}
function check()
{
if(document.images) //遍历页面中的图像
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown = noCopy;
}
</script>
</head>
<body onload="check()">
<img src='' width=70 height=50 border=1 alt='我的图片'>
<div>
<table width="300" height="50" border="0" cellspacing="2" cellpadding="0" bgcolor="#FFb609">
<tr>
<td bgcolor="#ccffff">禁止复制网页中所有图片...</td>
</tr>
</table>
</div>
</body>
</html>