当我从中选择图像时,下拉列表中有一组图像,相应的图像正在加载。
我的问题是,如果我单击图像,它必须将我带到图像的相应 HTML 页面。我在 jQuery 中执行它。我已经代表了下面的代码,你也可以参考这个链接 http://www.olivepropertyglobalsolutions.com/
HTML:
<div class = "right">
<h4 class = "heading"> Browse Listings </h4>
<select style = "margin-top: 55px; margin-left: 18px;" name="image" id="image1" class="inputbox" size="1">
<option value=""> - Select - </option>
<option value="thumbs/3.jpg" >Farm Lands</option>
<option value="thumbs/1.jpg" alt = "flat.html">Flats</option>
<option value="thumbs/2.jpg" alt = "house.html">Houses</option>
<option value="thumbs/4.jpg" alt = "vacant.html">Vacant Lands</option>
<option value="thumbs/5.jpg" alt = "villa.html">Villas</option>
</select>
<div style = "margin-left: 14px;">
<a id="imagePreview" href = ""> </a>
</div>
</div>
查询:
<script type="text/javascript">
$(document).ready(function() {
$("#image1").change(function() {
$("#imagePreview").empty();
if ( $("#image1").val()!="" ) {
$("#imagePreview").append("<img src=\"" + $("#image1").val() + "\" />");
} else {
$("#imagePreview").append("");
}
});
});
</script>