ajax 單個元素中實現多個回調函數的例子

          1.mousemat.htm
          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "<html>
          ?<head>
          ??<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
          ??<title>Untitled Document</title>
          ??<link rel='stylesheet' type = 'text/css' href = 'mousemat.css'>
          ??<script type='text/javascript'>
          ???var cursor = null;
          ???window.onload = function(){
          ????var mat = document.getElementById('mousemat');
          ????mat.onmousemove = mouseObserver;
          ????cursor = document.getElementById('cursor');
          ???}
          ???function mouseObserver(event){
          ????var e = event || window.event;
          ????writeStatus(e);
          ????drawThumbnail(e);
          ???}
          ???function writeStatus(e){
          ????window.status = e.clientX + "," + e.clientY;
          ???}
          ???function drawThumbnail(e){
          ????cursor.style.left = ((e.clientX/5)-2) + "px";
          ????cursor.style.top = ((e.clientY/5)-2) + "px";
          ???}
          ??</script>
          ?</head>
          ?<body>
          ??<div class='mousemat' id='mousemat'></div>
          ??<div class='thumbnail' id='thumbnail'>
          ???<div class = 'cursor' id = 'cursor'></div>
          ??</div>
          ?</body>
          </html>


          2.mousemat.css
          mousemat{
          ?background-color:#ffe0d0;
          ?border:solid maroon 0px;
          ?position:absolute;
          ?margin:0px;
          ?width:500px;
          ?height:500px;
          ?top:50px;
          ?left:50px;?
          }
          .thumbnail{
          ?background-color:#ffe0d0;
          ?border:solid maroon 0px;
          ?position:absolute;
          ?margin:0px;
          ?width:100px;
          ?height:100px;
          ?top:50px;
          ?left:600px;?
          }
          .cursor{
          ?background-color:blue;
          ?position:relative;
          ?height:5px;
          ?width:5px;
          }

          posted on 2006-08-11 16:12 software5168 閱讀(470) 評論(0)  編輯  收藏 所屬分類: Java學習

          <2006年8月>
          303112345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          導航

          統計

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          收藏夾

          JAVA學習網站

          綜合

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 祁门县| 饶河县| 磐安县| 会宁县| 彭泽县| 墨脱县| 和林格尔县| 淮南市| 江津市| 武鸣县| 晋宁县| 墨玉县| 丽水市| 巢湖市| 夏津县| 宁乡县| 青岛市| 渝中区| 渑池县| 临沭县| 石阡县| 建宁县| 五大连池市| 永嘉县| 包头市| 祥云县| 都昌县| 柞水县| 潍坊市| 名山县| 海林市| 金阳县| 沙湾县| 鄂尔多斯市| 合山市| 吴旗县| 清苑县| 盖州市| 甘南县| 张家港市| 三亚市|