JS-----------------图片转换

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>童心少年</title>
      
  </head>
  <body>    
    <h1 onclick = "updateimage()">点击一下</h1>
    <h1 onclick = " updatesize()">点击两下</h1>
    <h1 onclick = " updateborder()">点击三下</h1>
     <img id="img"> 
  <script>
      var srcHttp="https://game.gtimg.cn/images/yxzj/img201606/heroimg/";
    
      var i=105;
      function updateimage(){
        
          document.getElementById("img").src=srcHttp+String(i)+"/"+String(i)+".jpg";
          i++;
      }
      var w=80;
      function updatesize(){
         
          document.getElementById("img").width=w;
          document.getElementById("img").height=w;
          w+=40;
          w%=800;
      }
      var b=1;
       function updateborder(){
         
          document.getElementById("img").border=b;
          b++;
           b%=10;
      }
    </script>  
  </body>
</html>

 

posted @ 2025-11-21 19:48  付书恒  阅读(3)  评论(0)    收藏  举报