码迷,mamicode.com
首页 > 其他好文 > 详细

img 标签内如何在src中引用变量

时间:2019-02-22 16:59:33      阅读:659      评论:0      收藏:0      [点我收藏+]

标签:play   标签   res   ini   error   err   nta   isp   arc   

<html>
<head>
<script language="javascript">
var adres="https://offlintab.firefoxchina.cn/static/img/search/baidu_web.png";
function imgUrl() {
        document.images.imgInit.src = adres;
    }
</script>
</head>
<body>

<img id="imgInit"  src="乱设置一个就行" onerror="imgUrl()" style="width:50px;height:25px;display:block;" />

</body>
</html>

img 标签内如何在src中引用变量

标签:play   标签   res   ini   error   err   nta   isp   arc   

原文地址:https://www.cnblogs.com/lovehansong/p/10419119.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!