我的代码非常简单,因为我刚刚学习使用 JavaScript。
我试图让 HTML5元素在单击时button执行简单的警报功能。但是,对于以下代码,该按钮不执行任何操作。
function theFunction(){
alert("Hi there");
}Run Code Online (Sandbox Code Playgroud)
<button type="button" onlick="theFunction()">Button</button>Run Code Online (Sandbox Code Playgroud)
“onlick”改为“OnClick”拼写错误检查并改正
function theFunction(){
alert("Hi there");
}Run Code Online (Sandbox Code Playgroud)
<button type="button" OnClick="theFunction()">Button</button>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8016 次 |
| 最近记录: |