简单教程
提交运行
代码编辑器:
<script> function displayResult(){ var x=document.getElementById("button1").value; alert(x); } </script> <form> <input type="button" onclick="displayResult()" id="button1" value="显示按钮文本"> </form>
运行结果: