努力學習 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 飛仙 閱讀(647) 評論(0)  編輯  收藏 所屬分類: Javascript

          主站蜘蛛池模板: 景洪市| 尼勒克县| 丰城市| 周宁县| 勐海县| 乃东县| 昭苏县| 云林县| 会泽县| 博罗县| 东台市| 高平市| 安龙县| 万州区| 长宁区| 江阴市| 台北县| 九龙坡区| 肥西县| 昭觉县| 赣榆县| 易门县| 阜平县| 丹巴县| 西和县| 东辽县| 张家港市| 宝兴县| 定西市| 宽甸| 庐江县| 威远县| 河源市| 格尔木市| 大同市| 施秉县| 永平县| 青川县| 株洲县| 鱼台县| 泗阳县|