我是使用 span 的新手。我正在尝试在同一页面上打印两次从 javascript 脚本中获得的信息。
我可以打印一次获得的信息,但是当我决定第二次打印信息时,它不会显示
这个有效
<div id="layer4" class="auto-style10" style="position: absolute; width: 300px; height: 427px; z-index: 2; left: 1020px; top: 90px">
<span class="auto-style8"><h4>Incident Details</h4><br />
</span>
<br />
<h6> Report ID : </h6> <span id="ReportID"></span> <br />
<h6> Description : </h6> <span id="Description"></span><br />
<h6> Category : </h6> <span id="Category"></span> <br/>
<h6> Date and Time : </h6> <span id="DateTime"></span> <br />
<h6> User Id/ Mobile Number : </h6> <span id="UserID"></span><br />
<br />
<span id="ReportID"></span>
<form method="post" action="http://www.al-qarra.com/police_new/map2/changelevel.php" >
<select name="SelectCat" style="position: absolute; width: 60px; z-index: 2;">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input name="reportno" type="hidden" value="<?php echo $_SESSION['incidentid']; ?>">
<input name="ChangeCat" id="SelectCat" type="submit" value="Change Status" style="position: absolute; left: 100px; width: 110px; z-index: 2;"/>
</form>
</div>
但是当我将相同的 div 复制到同一页面但不同的位置时,它不会显示信息
<div id="layer44" class="auto-style10" style="position: absolute; width: 300px; height: 427px; z-index: 2; left: 1020px; top: 300px">
<span class="auto-style8"><h4>Incident Details</h4><br />
</span>
<br />
<h6> Report ID : </h6> <span id="ReportID"></span> <br />
<h6> Description : </h6> <span id="Description"></span><br />
<h6> Category : </h6> <span id="Category"></span> <br/>
<h6> Date and Time : </h6> <span id="DateTime"></span> <br />
<h6> User Id/ Mobile Number : </h6> <span id="UserID"></span><br />
<br />
</div>
这是我要求的 javascript
</style>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
$("#ReportID").text(nreportid);
$("#Description").text(ndesc);
$("#Category").text(ncat);
}
</script>