<p>
<img src="1.jpg">
</p>
<botton>加载</botton>
var btn = document.getElementsTagName("botton")[0];
btn.onclick = function(){
//如何点击时加载上面图片?`请输入代码`
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
点击的时候动态添加src属性
$("img").one("load", function() {
// do stuff
}).each(function() {
if(this.complete) $(this).load();
});
可以看下lazyload