网页浏览总次数

2011年12月20日星期二

iframe2.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  <html>    <head>    <title>Untitled</title>  </head>  <style>  body {    font-size: 12px;    color: gray;  }  </style>  <script type="text/javascript">      window.onload = function() {        document.getElementById('title').innerHTML = 'Domain: ' + document.location.host;        window.document.onmousemove = function(e) {        var x = (window.Event) ? e.pageX : window.event.clientX;        var y = (window.Event) ? e.pageY : window.event.clientY;        window.parent.frames[0].postMessage('x = ' + x + ' y = ' + y, '*');            };        var onmessage = function(e) {        var data = e.data;        var origin = e.origin;        document.getElementById('display').innerHTML = data;      };        if (typeof window.addEventListener != 'undefined') {        window.addEventListener('message', onmessage, false);      } else if (typeof window.attachEvent != 'undefined') {        window.attachEvent('onmessage', onmessage);      }    };    </script>    <body>  <div id="title"></div>  <br>  <div id="display"></div>  </body>    </html>   

没有评论:

发表评论