<div style="position:relative;">
<div id="container1997"></div>
<img src="img/2.png" onclick="showEarth(1997)" style="width:50px; height:10px;">
</div>
在<div id="container1997"></div>中插入一段代码<img src="img/site.png" style="z-index: 1100; width:10px;position:absolute; bottom: -5px;left:40%;" >
代码如下:
html1= ‘<img src="img/site.png" style="z-index: 1100; width:10px;position:absolute; bottom: -5px;left:40%;" >’;
id=“#container1997”;
$(id).html(html1);
注:html是完全替换,用$(id).html(html1);将替换掉<div id="container1997"></div>中的全部内容,若用append则是加一段内容。