javascript: functionname() instread of functionname()
javascript: functionname() instread of functionname()
为什么有些开发人员使用
<input type="button" onClick="javascript:function-name()">
而不是
<input type="button" onClick="function-name()">
请帮我解决这件事。
因为他们可能只是不太清楚,认为无论何时在HTML属性中使用JS,都必须使用javascript:
。
在事件处理程序属性中,javascript:
只是一个标签,完全无用。
然而,它在href
属性中是必要的,但它有一个完全不同的含义:它是一个伪协议,它告诉浏览器将"URI"的剩余部分解释为JavaScript。
(更不用说在href
中使用JS被认为是不好的做法)
相关文章:
- HighChart : Usage of setData
- Difference between methods of defining JavaScript 'class
- 为什么我在下面的..of循环中得到意外令牌
- Appending the innerhtml of <th>
- Animation cuts off multiple lines of text in <p>
- javascript: functionname() instread of functionname()
- jQuery使用.of()删除事件处理程序时出现的问题
- Three.js issue creating meshes outside of loader's load(
- jquery in the middle of html
- JavaScript equivalent of C#'s DynamicObject?
- nodejs console.log of object
- SCRIPT5007:属性onclick=;JavaScript:functionName('name'
- value of jquery sortable
- Javascript imageData returns array of 0's
- 对于grunt构建中的(let.of)错误
- Opposite of jQuery's :eq()
- Implementation of jQuery 'animate' with Meteor
- 当调用.of()然后调用.on()时,Jquery是否可能将事件推迟
- Angularjs ng-options selected value of dropdownlist
- Java eqivalent method of “splice(a,b,..)“在 JavaScript 方法中