87,909
社区成员
发帖
与我相关
我的任务
分享
str = "<div>"
+"<tr>"+ "<br>"+ "<br>"
+ "<td width='60px' align='right'><font size='3'>地址:</td>"
+ "<td width='120px' align='left'><font size='3' color='#ff0000'>" + feature.get('coor') + "<br>" + "</font></td>"
+ "<td width='150px' height='180px' id='<strong>chartcontainer</strong>' rowspan='4'></td>"
+ "</tr>"
+ "<hr style='height:10px;border:none;border-top:1px dashed #0066CC;' />"
+ "<tr>"
+ "<td width='60px' align='right'>温度:</td>"
+ "<td width='120px' align='left'><font color='#ff0000'>" + feature.get('temp') + "<br>" + "</font></td>"
+ "</tr>"
+ "<hr style='height:10px;border:none;border-top:1px dashed #0066CC;' />"
+ "<tr>"
+ "<td width='60px' align='right'>湿度:</td>"
+ "<td width='120px' align='left'><font color='#ff0000'>" + feature.get('humi') + "<br>" + "</font></td>"
+ "</tr>"
+ "<hr style='height:10px;border:none;border-top:1px dashed #0066CC;' />"
+ "<tr>"
+ "<td width='60px' align='right'>图片:</td>"
+ "<div id='gallery'>"
<!-- +"<ul>" -->
<!-- +"<li>" -->
+"<a href='__PUBLIC__static/admin/image/test.jpg'>"
+"<img src='__PUBLIC__static/admin/image/test.jpg' width='50' height='50' alt='' />"
+"</a>"
<!-- +"</li>" -->
<!-- +"</ul>" -->
+"</div>"
+ "</tr>"
+ "<hr style='height:10px;border:none;border-top:1px dashed #0066CC;' />"
+ "<tr>"
+ "</div>";
content.innerHTML = str;
我的是因为在inner HTML里面都加载不到js [quote=引用 5 楼 lqlqlq007 的回复:]
[quote=引用 4 楼 u011301230 的回复:]
[quote=引用 2 楼 lqlqlq007 的回复:]
https://blog.csdn.net/lqlqlq007/article/details/78665962 看里面的load函数,应该是你需要的。
我的是因为在inner HTML里面都加载不到js [quote=引用 4 楼 u011301230 的回复:]
[quote=引用 2 楼 lqlqlq007 的回复:]
https://blog.csdn.net/lqlqlq007/article/details/78665962 看里面的load函数,应该是你需要的。
我的是因为在inner HTML里面都加载不到js [quote=引用 2 楼 lqlqlq007 的回复:]
https://blog.csdn.net/lqlqlq007/article/details/78665962 看里面的load函数,应该是你需要的。
[quote=引用 1 楼 jslang 的回复:]
用innerHTML设置的html代码中的script标签是不会真正加载的。
要用document.createElement("script")创建元素,并用appendChild()把元素放到页面中。需要注意这样js是异步加载和执行的(直接写在页面时是同步加载和执行)。
或者可以用jquery的 append() 来做, jquery会自动把html代码中的script标签提取出来,单独创建一个script元素放到head中加载。
$("#popup-content").append('<script src="__PUBLIC__static/admin/js/jquery.lightbox-0.5.js"><\/script>');
像这样好像还是没有加载[/quote]我的是因为在inner HTML里面都加载不到js https://blog.csdn.net/lqlqlq007/article/details/78665962 看里面的load函数,应该是你需要的。
https://blog.csdn.net/lqlqlq007/article/details/78665962 看里面的load函数,应该是你需要的。
用innerHTML设置的html代码中的script标签是不会真正加载的。
要用document.createElement("script")创建元素,并用appendChild()把元素放到页面中。需要注意这样js是异步加载和执行的(直接写在页面时是同步加载和执行)。
或者可以用jquery的 append() 来做, jquery会自动把html代码中的script标签提取出来,单独创建一个script元素放到head中加载。
$("#popup-content").append('<script src="__PUBLIC__static/admin/js/jquery.lightbox-0.5.js"><\/script>');
像这样好像还是没有加载