<input type="text" readonly name"name" id="id">用户点击此文本框时,弹出日历控件,选择日期后设置文本框的值。
要根据这个文本框的值,设置其他域的值,应该触发什么事件?我试了blur不行,change也不行。改怎么办?
 

解决方案 »

  1.   

    ie下 用onpropertychange 
    ff下 用oninput
      

  2.   

    终极方法:setInterval(function(){
    // 设置值},10);
      

  3.   

    不如换个思路,把相关处理都放在点击事件中处理!L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
      <input type="text" readonly name="name" id="calendarTxt"><input type="button" value="Change Date and Show" onclick="ChangeDatetime('calendarTxt');DoSomethingByInputDatetime('calendarTxt')" />
      <script type="text/javascript">
      <!--
    function ChangeDatetime(targetId) {
        var input = document.getElementById(targetId);
        if (input)
        {
            input.value = (new Date()).toLocaleDateString();
        }
    }
    function DoSomethingByInputDatetime(targetId) {
        var input = document.getElementById(targetId);
        if (input)
        {
            alert("输入的日期为:" + input.value);
        }
    }
      //-->
      </script>
     </body>
    </html>
      

  4.   

    结贴了。因为日历控件使用了一个现成的,所以试图不修改它,直接响应事件的方法达到目的。看来text框被readonly后很多事件就不响应了。抑或日历捕捉到事件后没有继续传播?现在决定修改日历控件代码了。