您的位置:首页 > 编程语言 > Go语言

统计google广告是否被点击次数

2012-10-28 12:53 453 查看
/*其实就是统计iframe中的链接被点击的次数*/

<html>

<head>

<title>统计点击计数</title>

<script language="javascript">

<!--

function keyDown(e)

{

//浏览器的X坐标

document.getElementById("xxx").innerHTML = event.clientX;

//浏览器的Y坐标

yyy.innerHTML = event.clientY;

/*

//event.srcElement就是指向触发事件的元素,他是什么就有什么的属性 srcElement 是事件初始目标的html元素对象引用,因为事件通过元素容器层次冒泡,可以在任一层进行处理,所以由一个属性指向产生初始事件的元素是很有帮助的.有了元素的引用,就可以读/写改元素的属性,并调用他的任何方法.

*/

se.innerHTML = event.srcElement.tagName;

/*

//属性,srcElement 产生事件的节点(DHTML对象) 当当前事件有移动成分时,如onmouseover、onmouseout等 fromElement、toElement 表示移动事件的两个端点

*/

fe.innerHTML = event.fromElement;

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;

}

}

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> <div id="xxx">x坐标</div><div id="yyy">y坐标</div><div id="se">来自</div><div id="fe">来自</div>

<iframe name='ad_click' marginwidth="0"

marginheight="0" frameborder="0" scrolling="no"

src='http://www.9core.com/' width="100"

height="100" style="width: 616px; height: 171px">

</iframe>

<br />

<br />

<a href="http://www.aili8.com/" target="_blank">8网</a>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: