我想在 ajax 的帮助下显示所选图像的幻灯片,并且获取标题对于显示相应的幻灯片非常重要,但是在JavaScript 中,单击图像的标题没有获取。
javascript:
function slide(s) {
var _event = s;
alert(_event);
}
代码:
<div id="inner_body">
<?php
$c = mysql_connect("localhost", "abc", "xyz");
mysql_select_db("root");
$sql = "select * from images where year=2000";
$qc = mysql_query($sql);
$count = 0;
while ($ans = mysql_fetch_array($qc)) {
$title = ucwords($ans['event']);
print "
<div class='img-wrap' onclick='slide($title)'>
<img id='display_img' src='images/thumbnails/$ans[image1]'>
<div class='img-overlay'>
<b1>" . $title . "</b1>
</div>
</div>";
}
?>
</div>