1
我仍在使用我的實時搜索功能。它完美地填充,但現在我想添加可單擊的行函數,該函數可以自行工作,但不能在將其與其他代碼集成時使用。Livesearch - javascript可點擊的行
http://www.fpmnky.com/ 這是沒有點擊代碼
http://www.fpmnky.com/index2.php 後,我增加額外的代碼,點擊行的實時搜索無法正常工作。 這與下面的代碼:
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/jquery.watermark.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#airport").watermark("");
$("#airport").keyup(function()
{
var airport = $(this).val();
var dataString = 'keyword='+ airport;
if(airport.length>1)
{
$.ajax({
type: "GET",
url: "ajax-search.php",
data: dataString,
beforeSend: function() {
$('input#airport').addClass('loading');
},
success: function(server_response)
{
$('#searchresultdata').html(server_response).show();
$('span#faq_category_title').html(airport);
if ($('input#airport').hasClass("loading")) {
$("input#airport").removeClass("loading");
}
}
});
}return false;
});
});
jQuery(function($) {
$('tr[href]').addClass('clickable').click(function() {
window.location = $(this).attr('href');
}).find('a').hover(function() {
$(this).parents('tr').unbind('click');
}, function() {
$(this).parents('tr').click(function() {
window.location = $(this).attr('href');
});
});
$('tr[href]').css('cursor', 'pointer');
$('tr[href]').hover(function() {
$(this).css('cursor','pointer');
});
});
</script>
我猜測它是一種格式問題,我還是新的JavaScript/jQuery的,所以幫我在這裏。
謝謝