0

i have a textbox named date and a link as shown below

<input type="text" name="date">
<a href="javascript:" onclick="cal.select(document.getElementById('date')"><img src='cal.jpg'>

once i click on the calendar icon, calendar appears . if i select date it gets populaged in textbox named "date". now i need to write an ajax code to populate another drop down BASED ON the date selection. And hence i tried onchange event on date textbox.

<input type="text" name="date" onChange="javascript:getDate()">

javascript.js is the file where i have all my js. but i wonder the change event is not getting called once the value changes. But the value is getting populated correctly based on the user date selection.

Question : How to make an onchange event on this .

4

1 回答 1

0

好吧,这是一个老问题,但用户必须点击日历图像吗?您可能可以通过这种方式轻松修复:

<input type="text" name="date" onFocus='javascript:cal.select(document.getElementByID("date");' onBlur="javascript:getDate()">

这样,当您单击日历时,它将模糊该字段并立即调用 javascript 函数。

于 2013-07-12T19:01:28.923 回答