为什么不是't按钮报告显示

Why isn't the button report showing?

本文关键字:按钮 报告 显示 为什么不      更新时间:2023-12-30

由于某些原因,当我运行此程序时,当我按下按钮时,无法弹出警报

<head>
    <title>OnMouseOver Demo</title>

我的脚本

function buttonReport(buttonId, buttonName, ButtonValue) {
    //information about the id of the button
    var userMessage1 = "Button id: " + buttonId + "/n";
    //then about the button name
    var userMessage2 = "Button name: " + buttonName + "/n";
    //and the button value
    var userMessage 3 = "Button value: " + buttonValue;
    // alert the user   
    alert(userMessage1 + userMessage2 + userMessage3);
}

我体内有这个

<input type="button" id="id1" name="Left Hand Button" value="Left" 
onclick = "buttonReport (this.id, this.name, this.value)"/>
<input type="button" id="id2" name="Center Button" value="Center" 
onclick = "buttonReport (this.id, this.name, this.value)"/>
<input type="button" id="id3" name="Right Hand Button" value="Right" 
onclick = "buttonReport (this.id, this.name, this.value)"/>

如果这真的是你的代码,那么

var userMessage 3 = "Button value: " + buttonValue;

是语法错误。3之前不应有空格。

User@Pointy在第一部分是对的。

如果这真的是你的代码,那么

var userMessage 3 = "Button value: " + buttonValue;

是语法错误。3之前不应该有空格。区块报价

我还在函数arguments/parameters中使用了ButtonValue则实际函数中不带大写字母b的按钮值