我还在开发我的实时搜索功能。它可以完美地填充数据,但现在我想添加可点击的行函数,该函数可以独立工作,但不能在与其他代码集成时工作。
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新手,所以请帮帮我。
谢谢
发布于 2013-01-01 05:29:55
您在第50行有一个错误。
$("#airport").watermark("");这个水印函数似乎引起了一个问题。使用Firefox并按strg+shift+k查看错误。在第一页上,您不会看到此错误消息。由于这个问题,我认为并不是所有的JS都被执行,我认为这就是你的问题。
https://stackoverflow.com/questions/14106066
复制相似问题