Jquery SMarttextbox
<table width="1000px" border="0" cellspacing="0" cellpadding="5" >
<tr>
<td>
<form name="addtravel_form" id="addtravel_form" action="searchresult.php" method="post" enctype="multipart/form-data">
<table width="1000px;" border="0" cellspacing="0" cellpadding="5" class="box">
<tr bgcolor="#DADADA">
<td class="bline" colspan='2'>
<div class="px12 boldfont black fontarial"></div>
</td>
<td align="right" class="bline">
<div class="px12 boldfont black fontarial">Step : 1</div>
</td>
</tr>
<tr>
<td class="fontarial brown px12" style="width:250px;">
Departure month
</td>
<td colspan='2'>
<div id="tour_departuremonthdiv">
<input type="text" name="tour_departuremonth" id="tour_departuremonth" style="padding-left:4px; padding-top:4px;" value="" class="lgtxt" size='27' />
</div>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<script type="text/javascript" src="admin/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="admin/js/jquery.ui.core.js"></script>
<script type="text/javascript" src="admin/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="admin/js/jquery.ui.datepicker.js"></script>
<link type="text/css" href="admin/demos.css" rel="stylesheet" />
<link charset="utf-8" media="screen" type="text/css" href="admin/SmartTextBox.css" rel="stylesheet"/>
<script charset="utf-8" type="text/javascript" src="admin/SmartTextBox.js"></script>
<script type="text/javascript" src="admin/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="admin/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="admin/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$("#tour_departuremonth").smartTextBox({
autocompleteUrl: "admin开发者_开发技巧/create_daymonths.php",
onlyAutocomplete: true,
uniqueValues: true,
debug: true
});
$('#tour_departuremonthdiv').live('mouseout', function() {
alert($("#tour_departuremonth").val());
inint();
});
function inint() {
var tour_departuremonths = $("#tour_departuremonth").val();
//alert(tour_departuremonths);
alert('month'+tour_departuremonths);
}
});
</script>
The problem is that if I typed "apr 2010", the alert box does not show it the first time but if i later typed "may 2010" then only "apr 2010" shows up on the alert.
However if I do a mouseout, it works perfectly well expcept that everytime I do a mouseout the alert shows up... Ideally the event should fire only when I change the values in smartbox.
Any ideas why it does not work?
Please note that i have three smart boxes in a form. The other two smartboxes work perfectly fine.
Any help is appreciated.
Your first alert is within a mouseout event, and will therfore only be shown when the corresponding event is triggered.
精彩评论