努力學習 Java

          知之者不如好之者,好之者不如樂之者,樂之者不如癡之者

          鼠標放到圖片上慢慢變大,移開后圖片又慢慢變小

          <html>
          <head>
          <title>鼠標放到圖片上慢慢變大,移開后圖片又慢慢變小? </title>
          <meta http-equiv="Content-Type" content="text/html;charset=gb2312">
          </head>
          <body>
          <img id="MyImg" onmouseover="max()" onmouseout="min()"
          src="pic.jpg" width="80" height="60">

          <script>

          var ?i = 0 ?
          var ?id1,?id2?;


          function ?max() {
          ?clearTimeout(id2)?;??
          // 必須清除,不然圖象會抖動
          ?nLong? = ?MyImg.style.pixelWidth? += ?i ++ ?
          ?MyImg.style.pixelHeight?
          = ?nLong * aaa?
          ?
          if ?(i < 20 )?id1 = setTimeout('max()',? 100 );
          }

          function ?min()? {
          ?clearTimeout(id1)?;???
          // //必須清除,不然圖象會抖動
          ?nLong? = ?MyImg.style.pixelWidth? -= ? -- i?
          ?MyImg.style.pixelHeight?
          = ?nLong * aaa?
          ?
          if ?(i > 0 )?id2 = setTimeout('min()',? 100 )?
          }


          function ?init()? {
          ?aaa?
          = ?MyImg.height / MyImg.width?
          ?MyImg.style.pixelWidth?
          = ? 80
          ?MyImg.style.pixelHeight?
          = ? 60 ?
          }


          onload?
          = ?init? // init?不能有括號,不能有引號;等效于<body?onload?="init()">?

          </script>

          </body>
          </html>

          posted on 2006-07-05 14:52 飛仙 閱讀(650) 評論(0)  編輯  收藏 所屬分類: Javascript

          主站蜘蛛池模板: 灌阳县| 长泰县| 抚顺县| 温州市| 五河县| 醴陵市| 湾仔区| 文化| 石台县| 新化县| 双流县| 徐汇区| 太和县| 长岛县| 舒兰市| 绥芬河市| 新郑市| 寿光市| 高清| 永顺县| 泰和县| 盖州市| 开江县| 双鸭山市| 渭南市| 兖州市| 都安| 修文县| 绍兴县| 南溪县| 大连市| 宁阳县| 刚察县| 手机| 化德县| 丰城市| 玉环县| 林西县| 沅江市| 济宁市| 梁山县|