努力學習 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

          主站蜘蛛池模板: 遵化市| 平罗县| 娄底市| 南皮县| 大同县| 疏勒县| 鄂州市| 张家界市| 平舆县| 泾源县| 东乡族自治县| 宁津县| 康定县| 惠来县| 梅州市| 建宁县| 永修县| 天津市| 涿鹿县| 四会市| 荔浦县| 东城区| 随州市| 汪清县| 平塘县| 泗水县| 图们市| 资中县| 镇赉县| 洪湖市| 祁连县| 广平县| 江山市| 阳信县| 兴业县| 永州市| 遵义市| 元阳县| 迭部县| 昆明市| 衡东县|