HTML處的內容:
JavaScript處的內容:
- <form action = "#" onsubmit = "return check();">
- <input type = "text' id = "age" value = "">
- </form>
- <script type="text/javascript">
- function check()
- {
- var age = document.getElementById( "age" ).value;
- if( isNaN( age) )
- {
- alert( '該資料不可包含文字!' );
- }
- }
- </script>
沒有留言:
張貼留言