在 Javascript 中引用图像
我正在使用一个 javascript 地图,我正在尝试将图像添加到工具提示中,
这是代码:
var shardicon = L.Icon.extend({
iconUrl: 'images/A.png',
shadowUrl: '',
iconSize: new L.Point(20, 30),
iconAnchor: new L.Point(10, 15),
popupAnchor: new L.Point(-0, -20)
});
var shard = new shardicon()
var marker7 = new L.Marker(new L.LatLng(51.504409, -0.086335), {icon: shard})
marker7.bindPopup("<h1>The Shard</h1>");
当我尝试将图像引用添加到 HTML 位(分片位)时,它会关闭“引号”和休息。
知道我该怎么做吗?
提前致谢!
I have a javascript map I'm using and I'm trying to add an image to the tooltip
Here is the code:
var shardicon = L.Icon.extend({
iconUrl: 'images/A.png',
shadowUrl: '',
iconSize: new L.Point(20, 30),
iconAnchor: new L.Point(10, 15),
popupAnchor: new L.Point(-0, -20)
});
var shard = new shardicon()
var marker7 = new L.Marker(new L.LatLng(51.504409, -0.086335), {icon: shard})
marker7.bindPopup("<h1>The Shard</h1>");
when I try to add an image reference into the HTML bit (the shard bit) it closes the 'quote marks' and breaks.
Any idea on how I would go about this?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Javascript 中,您可以使用双引号和单引号,使用一个引号来分隔 JS 解释器的外部字符串,另一个用于分隔 HTML,如下所示:
或者,也可以这样做:
In Javascript, you can use both double quote and single quotes, using one to delimit the outside string for the JS interpreter and the other for your HTML like this:
or, it can be done like this too: