js changeAttribute.html

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js changeAttribute</title>
    <script src="lib/jquery/jquery-3.2.1.js"></script>
</head>
<body>
    <img id="img" src="img/bulbOn.gif" width="160" height="120">
    <script>
        // document.getElementById("img").src="img/landscape.jpg";
        $("#img").attr("src", "img/landscape.jpg");
    </script>
</body>
</html>

        
        
发布了197 篇原创文章 · 获赞 61 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/weixin_42193179/article/details/105330482