例如:
var url;
<img src = url/>
7 个解决方案
#1
方法一
<img id="pic" />
<script type="text/javascript">
var url = "xxx.jpg";
document.getElementById("pic").src = url;
</script>
#2
方法二
<script type="text/javascript">
var url = "xxx.jpg";
document.write('<img src="'+url+'" />');
</script>
#3
var sContent =
"<img style='float:right;margin:4px' src = 'images/1.jpg' width='139' height='104'/>" +
"</div>";
var infoWindow = new BMap.InfoWindow(sContent);
这是源码,我想将src的值用一个变量传进去,显示在定义的信息窗口,该怎么做啊
"<img style='float:right;margin:4px' src = 'images/1.jpg' width='139' height='104'/>" +
"</div>";
var infoWindow = new BMap.InfoWindow(sContent);
这是源码,我想将src的值用一个变量传进去,显示在定义的信息窗口,该怎么做啊
#4
var url = "images/1.jpg";
var sContent ="<div><img style='float:right;margin:4px' src = '" + url + "' width='139' height='104'/>" + "</div>";
var infoWindow = new BMap.InfoWindow(sContent);
#5
哈哈,好了,谢谢了
#6
l楼主能说说怎么成的吗
#7
就是把图片路径定义成一个变量,在img中设置id的值,然后实现的
#1
方法一
<img id="pic" />
<script type="text/javascript">
var url = "xxx.jpg";
document.getElementById("pic").src = url;
</script>
#2
方法二
<script type="text/javascript">
var url = "xxx.jpg";
document.write('<img src="'+url+'" />');
</script>
#3
var sContent =
"<img style='float:right;margin:4px' src = 'images/1.jpg' width='139' height='104'/>" +
"</div>";
var infoWindow = new BMap.InfoWindow(sContent);
这是源码,我想将src的值用一个变量传进去,显示在定义的信息窗口,该怎么做啊
"<img style='float:right;margin:4px' src = 'images/1.jpg' width='139' height='104'/>" +
"</div>";
var infoWindow = new BMap.InfoWindow(sContent);
这是源码,我想将src的值用一个变量传进去,显示在定义的信息窗口,该怎么做啊
#4
var url = "images/1.jpg";
var sContent ="<div><img style='float:right;margin:4px' src = '" + url + "' width='139' height='104'/>" + "</div>";
var infoWindow = new BMap.InfoWindow(sContent);
#5
哈哈,好了,谢谢了
#6
l楼主能说说怎么成的吗
#7
就是把图片路径定义成一个变量,在img中设置id的值,然后实现的