简体   繁体   English

Onchange无法使用Javascript输入

[英]Onchange is not working with Javascript entry

I have a form with some dates to be filled in. I'm using Cold Fusion, but here am using just the form and input tags, not the "enhanced" CF tags. 我有一个表格,其中有一些日期需要填写。我使用的是Cold Fusion,但这里仅使用表格和输入标签,而不是“增强型” CF标签。 The user can select these dates only from a Javascript calendar. 用户只能从Javascript日历中选择这些日期。 The calendar works fine, the dates get filled in, the Javascript function "validx" is working, but the onchange does not fire with this data entry method. 日历工作正常,日期已填写,Javascript函数“ validx”正在运行,但是onchange不会使用此数据输入方法触发。

<input 
  type     = "text" 
  id       = "#colid#"
  class    = "calendarSelectDate"  {this fires the calendar}             
  name     = "#col#" 
  readonly                         
  onclick  = "tooltip(#i#)"
  onchange = "validx(#i#, #top#, '#thecase#', '#themsg#')"
  value    = "#sv#" >

I can get onblur to do the job, but would really prefer onchange. 我可以模糊地胜任这份工作,但真的更喜欢onchange。 Anyone have a way to do this? 有人有办法吗? Thanks. 谢谢。

I believe you are misunderstanding the purpose of onchange . 相信您误解了onchange的目的。 This event fires when the user blurs the checkbox after making a change. 当用户在进行更改模糊复选框时,将触发此事件。 By definition it requires a blur. 根据定义,它需要模糊。 Perhaps you should look into onkeyup or similar events involving keypresses. 也许您应该研究onkeyup或涉及按键的类似事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM