女排夺冠视频,正品百家乐,景天三七根
首发日期:2018-05-11
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Document</title> <script> function f1(){ return document.getElementById('i1').value; } function f2(msg){ alert(msg); } (function f3(){ alert("hello") })(); </script> </head> <body> <input id='i1' type="button" value="点击" onclick="f2(f1())"> <!-- 自执行函数在上面时,如果是堵塞型的函数(比如alert),那么会影响下面的内容出现 --> 123 </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Document</title> </head> <body> <input id='i1' type="button" value="点击" onclick="alert('hello')"><!-- 第一种 --> <input id='i2' type="button" value="点击2" > <input id='i3' type="button" value="点击3" > <script> function f2(){ alert("hello2"); } document.getElementById("i2").onclick=f2; //第二种 document.getElementById("i3").addEventListener("click", f2);//第三种 </script> </body> </html>
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Object.keys() 和 Object.getOwnPropertyNames() 的区别详解
JavaScript使用prototype属性实现继承操作示例
JavaScript直接调用函数与call调用的区别实例分析
JavaScript设计模式--简单工厂模式实例分析【XHR工厂案例】
网友评论