统计Google广告点击次数的方法
下面介绍一个可以统计Google那样广告点击次数的方法。
<html>
<head>
<title>点击计数</title> <script language="javascript"> <!-- function keyDown(e) { if (event.srcElement.tagName=='IFRAME' && event.clientX==-1 && event.clientY==-1 && event.fromElement=='[object]'){ // 如果需要向其他页面提交 //document.adform.submit(); var num = parseInt(shownum.innerHTML); shownum.innerHTML = num + 1; } return false; } document.onmousemove=keyDown; document.onmouseover=keyDown ; document.onmouseout=keyDown ; document.onblur=keyDown; //--> </script>
</head>
<body>
<!-- 如果需要向另外一个页面传递参数,可以用下面的方式//-->
<form name="adform" method="post" action="ad_click.php" target='ad_click'>
<input name="uid" value='1922' type="hidden" id="uid">
<input name="keyid" type="hidden"
value='1119342517' id="keyid">
<input name="aid" type="hidden" id="aid">
</form>
<iframe name='ad_click' marginwidth="0"
marginheight="0" frameborder="0" scrolling="no"
src='about:blank' width="0" height="0">
</iframe>
<!--页面提交代码结束//-->
![]()
点击IFrame中的次数:<div id="shownum">
0</div>
<iframe name='ad_click' marginwidth="0"
marginheight="0" frameborder="0" scrolling="no"
src='http://www.csdn.net/' width="100"
height="100" style="width: 616px; height: 171px">
</iframe>
<br />
<br />
<a href="http://blog.joycode.com/" target="_blank">本页其它连接</a>
</body>
</html>
上述代码中,我们在点击、移动等事件中,判断用户点击的是不是某个需要的范围内。然后进行计数,如果我们需要额外的记录,可以在这些事件函数中,向一个我们可控的页面进行提交。为了不影响页面的展示,这个页面被提交的页面,是在一个隐含的IFrame中实现的,具体看上述代码就明白了。
posted on 2005-06-21 17:11:00 by ghj1976 评论(17) 阅读(7758)



OleDbConnection nwindConn
}
table1.PrimaryKey
}