代码如下:

Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>必须点击广告才能下载</title>
<style type="text/css">
#ad{ width:300px; height:250px; border:#0066FF 1px solid; padding:10px;}
</style>
<script language="javascript">
var downs=false
function down(num){
if(num==1)
downs=true;
if(!downs){
alert("必须点击广告才能下载!")
document.getElementById('ad').style.border='1px #ff0000 solid'
return false
}
}
</script>
</head>
<body>
<div id="ad" onclick="down(1)"><a href="http://bokezhuti.cn" target="_blank">这是广告</a></div>
<a href="http://bokezhuti.cn/down.rar" onclick="return down(0)">下载地址</a>
</body>
</html>
放在#ad标记里面的是广告,如Google的,阿里妈妈的.
当#ad标记里面存在click时,就可以点击下载,否则弹出提示,并将#ad的边线变成红色.