<html> <head> <script type="text/javascript"> function alertValue() { alert(document.getElementById("hidden1").value) } </script> </head> <body> <form> <input type="hidden" id="hidden1" value="yige" /> <input type="button" id="button1" onclick="alertValue()" value="Show value of the hidden field" /> </form> </body> </html>
结果:
编辑上面的代码,点击查看结果。
yige.org
- 试一个