您好我有一个功能
Fortune.prototype.entername = function () {
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
"Hello " + person + "! Check Your Fortune";
};
this.words();
}
我想用按钮调用它
这是我的代码<p class="dark" id="demo"><button onclick="this.entername()">Click to Enter Name & see your Fortune</button></p>
然而它说this.entername()
不是一个功能。愚蠢的错误我不知道怎么称它为完整的js代码在这里https://jsfiddle.net/e9zywrnt/