开发者社区> 问答> 正文

javascript触发onchange失败

网页上有个textarea ,代码如下:
<textarea class="text " id="arid_WIN_1_301398800" cols="20" maxlen="0" style="top: 0px; left: 82px; width: 183px; height: 47px;" arautocak="0" arautoctt="400" rows="3" wrap="soft"></textarea>

追踪事件截图:screenshot
关联代码如下:

 return function(h) {

  if (getIsInInterruptMode_NS(getCurrentWindowID_NS()) == 1 || isFromResume == 1) {

    var g = new FormEvent(h);

    var d = b(g);

    if (typeof d == "boolean" && d == false) {

      g.StopDefault()

    } else {

      if (typeof d == "string") {

        return d

      }

    }

  } else {

    var g = new FormEvent(h);

    var f = getCurWFC_NS(getCurrentWindowID_NS());

   if ((f != null) && (f.execStks != null) && (f.execStks[0] != null) && (f.execStks[0][0] != null) && ("f" in f.execStks[0][0]) && (f.execStks[0][0].f.toString().indexOf("hoverState.btnClickE") == -1)) {

      return

    }

    var d = b(g);

    if (typeof d == "boolean" && d == false) {

      g.StopDefault()

    } else {

      if (typeof d == "string") {

        return d

      }

    }

  }

}

下列代码为何不起作用?getElementById().onchange()无法运行

 document.getElementById('arid_WIN_1_301398800').value='123';

展开
收起
小旋风柴进 2016-06-01 12:49:50 2474 0
1 条回答
写回答
取消 提交回答
  • 事件绑定代码在哪里?document.getElementById('arid_WIN_1_301398800').onchange();这样触发事件只能是使用document.getElementById('arid_WIN_1_301398800').onchange=function(){....}的才会执行,用addEventListener/attachEvent添加的无法触发

    2019-07-17 19:23:05
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
JavaScript面向对象的程序设计 立即下载
Delivering Javascript to World 立即下载
编程语言如何演化-以JS的private为例 立即下载