这适用于FF和Chrome,但点击在IE中没有任何操作。Internet Explorer无法识别脚本标记中的jquery
这是相关的javascript,在创建条目后调用。
<script>
$(".reserveAPickupAppointmentRoommateAppointment").click (function() {
if ($(this).hasClass("confirm")) {
}
else {
$("img").remove(".confirmAppointment");
$(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
$(this).addClass("confirm");
$(this).append("<img src=images/confirmAppointment.png class=confirmAppointment id=roommateAppointment>");
var entry = this;
$(".confirmAppointment").click (function() {
$(".confirmAppointment").unbind("click");
var location = $(".reserveAPickupAppointmentLocation", entry).text();
alert (location);
});
}
});
</script>
培训相关的PHP/HTML ... jQuery的immedeatly遵循这个脚本标签
echo '<table>';
while ($row = mysql_fetch_array($result)) {
echo
'<tbody class = "reserveAPickupAppointmentRoommateAppointment">
<tr>
<td>'
.$row["name"].
'</td>
<td>
<span class = "reserveAPickupAppointmentlocation">'
.$row["location"].
'</span>
</td>
<td>
<span class = "reserveAPickupAppointmentSublocation">'
.$row["subLocation"].
'</span>
</td>
</tr>
<tr>
<td>
<span class = "reserveAPickupAppointmentStartTime">'
.$row["startTime"].
'</span> -
<span class = "reserveAPickupAppointmentEndTime">'
.$row["endTime"].
'</span>
</td>
<td>
<span class = "reserveAPickupAppointmentDate">'
.$row["date"].
'</span>
</td>
</tr>
</tbody>';
}
echo '</table>
使用警报
$(".reserveAPickupAppointmentRoommateAppointment").click (function() {
if ($(this).hasClass("confirm")) {
}
else {
$("img").remove(".confirmAppointment");
alert ("TEST1");
$(".reserveAPickupAppointmentRoommateAppointment").removeClass("confirm");
alert ("TEST2");
$(this).addClass("confirm");
alert ("TEST3");
$(this).append("<img src=\'images/confirmAppointment.png\' class=\'confirmAppointment\' id=\'roommateAppointment\'>");
alert ("TEST4");
var entry = this;
alert ("TEST5");
$(".confirmAppointment").click (function() {
$(".confirmAppointment").unbind("click");
var location = $(".reserveAPickupAppointmentLocation", entry).text();
alert (location);
});
}
});
标记? [SSCCE](http://sscce.org)? A [jsFiddle](http://jsfiddle.net),也许? _好吧,如果你不打算付出努力,那么我也不会。 – 2011-12-24 05:16:46
对不起,我今天刚刚学习了jsFiddle,现在我会尝试...并且我承诺我已经付出了努力在这。 – radleybobins 2011-12-24 05:17:48
什么版本的IE? – 2011-12-24 05:17:55