我有 2 个 jquery 脚本和 1 个相互冲突的 javascript。
下面是代码。请让我知道如何解决这个问题
1.) 用于日历的 jquery
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript">
function getCityDate(cityName,StarType)
{
if(cityName && StarType)
{
// Call the php page to get the HTML
$.ajax({
url: 'ajaxSearchHotelDateSelect.php?cityName='+cityName+'&StarType='+StarType,
success: function(responseHTML) {
// Set the HTML somewhere on the page - note: if you are returning a full page of HTML you shouldn't include all the <html><body> tags etc...
$("#homeMainTextDiv").html(responseHTML);
// Now that your HTML is available in the DOM you can initiate the datepicker()
$("#StartDate").datepicker({
numberOfMonths: 3,
minDate: "0",
maxDate: "+1Y",
dateFormat : "dd-mm-yy",
/*
altFormat: "dd-mm-yy",
maxDate: "+3M +10D",
changeMonth: true,
changeYear: true,
showWeek: true,
firstDay: 1,
*/
showOn: "button",
buttonImage: "images/calander_hotel_booking_final.png",
showAnim: "slideDown",
buttonImageOnly: true,
showButtonPanel: true
});
}
});
}//if(cityName && StarType)
}
</script>
2.) jquery 自动完成
<script type="text/javascript" src="jquery/ajax-autocomplete/jquery.js"></script>
<script type='text/javascript' src='jquery/ajax-autocomplete/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="jquery/ajax-autocomplete/jquery.autocomplete.css" />
<script type="text/javascript">
$().ready(function() {
$("#searchText").autocomplete("ajaxSearchAutoComplete.php", {
width: 750,
matchContains: true,
mustMatch: true,
minChars: 3,
//multiple: true,
//highlight: true,
//multipleSeparator: ",",
selectFirst: true
});
});
</script>
3.) 带有黑屏的弹出窗口的 Javascript
<body onload="Popup.showModal('modal',null,null,{'screenColor':'#333333','screenOpacity':.5});return false;" >
<script src="js/popup.js" type="text/javascript"></script>
<center>
<div id="modal" style="border:0px solid #0066FF ; padding:5px; font-size:150%; text-align:center; display:none; width:300px; height:250px;">
<a href="index.php" target="_self"></a><input type="image" src="images/close.png" width="30" height="30" alt="X" onClick="Popup.hide('modal')" style="cursor:pointer; float:right;">
<div style="background:url(images/homeDateSelectionBg.png) no-repeat left top; width:292px; height:192px; margin-top:25px;">
</div>
</div>
</center>
如果我删除自动完成 jquery 并弹出 javascript,日历可以正常工作,否则不能。
如何解决?我的日历是通过 ajax 和弹出窗口来的。