小编Jam*_*ell的帖子

我的Javascript函数没有被调用

我正在尝试学习Javascript中函数的工作原理.这应该是输出用户消息的函数.当我点击我的3个按钮时没有任何反应.我究竟做错了什么?多谢你们.

function buttonReport(buttonId, buttonName, buttonValue) {
    var userMessage1 = "Button id: " + buttonId + "\n";
    var userMessage2 = "Button name: " + buttonName + "\n";
    var userMessage3 = "Button Value: " + buttonValue + "\n";
}
Run Code Online (Sandbox Code Playgroud)
<input type="button" id="id1" name="Left Hand Button" value="Left" onclick="buttonReport(this.id, this.name, this.value)"/>
<input type="button" id="id1" name="Center Button" value="Center" onclick="buttonReport(this.id, this.name, this.value)"/>
<input type="button" id="id1" name="Right Hand Button" value="Right" onclick="buttonReport(this.id, this.name, this.value)"/>
Run Code Online (Sandbox Code Playgroud)

javascript html5 function

-5
推荐指数
1
解决办法
76
查看次数

标签 统计

function ×1

html5 ×1

javascript ×1