zoukankan      html  css  js  c++  java
  • onclick事件没有反应的五种可能情况

    转自:https://blog.csdn.net/qujing_1120/article/details/76853039

    onclick=”alert()” 事件没有反应的几种情况。
    第一:
    <input type="button" onclick="alert(‘'a'')" value="alert测试"/>
    双引号包括双引号,将里面的双引号改为单引号。

    第二:
    <input type="button" onclick="alert(a)" value="alert测试" />

    A没有赋值你或者 a的赋值写在了script里面,而没有写在head里面。这就是公共变量的问题。

    第三<input type="button" onclick="name" value="alert测试"/>
    事件调用的是方法,是方法就应该加()小括号。忘了加小括号。

    第四
    <input type="button" onclick="name()" value="alert测试"/>

    方法名是name()。可能与某些关键词冲突,换一个名字或者加个123以示区别就行。有时有些浏览器反而没问题,不过还是尽量避开关键词关键标签等的好。

    第五种,只能说是其他。

    有可能是标签错误缺失,关键词错误。分号多写少些,逗号多写等等语法错误.

  • 相关阅读:
    topcoder srm 320 div1
    topcoder srm 325 div1
    topcoder srm 330 div1
    topcoder srm 335 div1
    topcoder srm 340 div1
    topcoder srm 300 div1
    topcoder srm 305 div1
    topcoder srm 310 div1
    topcoder srm 315 div1
    如何统计iOS产品不同渠道的下载量?
  • 原文地址:https://www.cnblogs.com/sharpest/p/10164341.html
Copyright © 2011-2022 走看看