form自定義送出事件 [HTML]
| <script type='text/javascript'> | |
| function check_data() { | |
| if (document.myForm.VAB01.value.length==0) { | |
| alert('作者不可以空白'); | |
| } else if(document.myForm.VAB02.value.length==0) { | |
| alert('標題不可以空白'); | |
| } else if(document.myForm.Content.value.length==0) { | |
| alert('內容不可以空白'); | |
| } else { | |
| myForm.submit(); | |
| } | |
| } | |
| </script> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <hr><form name='myForm' method='post' action='new_message.php' enctype='multipart/form-data'>主題:<input type='text' name='VAB01'><br>作者:<input type='text' name='VAB02'><br>內容:<textarea name='Content'></textarea><br> <input type='button' value='發表留言' onClick='check_data()'></form> | |
| </body> | |
| </html> |
留言