我使用了w3schools.com的基本示例来到这里:
https://jsfiddle.net/02wu0v49/
function myFunction() {
var x = document.getElementById("fname").value;
document.getElementById("demo").innerHTML = "aaaaaa";
document.getElementById("fname").value = "bbbbb";
alert("lala3");
}
<body>
<p>A function is triggered when the user releases a key in the input field. The function outputs the actual key/letter that was released inside the text field.</p>
Enter your name: <input type="text" id="fname" onkeyup="myFunction()">
<p>My name is: <span id="demo"></span></p>
</body>
不知何故w3schools版本有效,但它不会对jsfiddle做任何事情吗?
并且使用[code] [/ code]或者其他东西在stackoverflow上格式化代码真的很好......所有这些缩进都很糟糕。