<form action="__URL__/add" method="post" name="form1"  onsubmit="return isEmpty()">
                <table cellpadding=3 cellspacing=5>
                    <tr>
                        <td width="10" align="center">ID</td>
                        <td width="80" align="center">排序</td>
                        <td width="80" align="center">内容</td>                                    
                        <td width="80" align="center"> 操作 </td>             
                    </tr>
                    
                    <tr>
                        <td width="10" align="center">1</td>
                        <td width="80" align="center"><input type="text" name="nu"/></td>
                        <td width="80" align="center"><input type="text" name="content"/></td>                                    
                        <td width="80" align="center"> 删除 </td>     
                    </tr>

                    
                    <tr></tr>
                </table>
             
                <hr>

                <input type="submit" value="确定" />
        </form>



 <SCRIPT language=javaScript>   

         function isEmpty(){   
            var nu=document.form1.nu;
            var content=document.form1.content; 
         
            if(nu.value==""){   
                alert("排序不能为空!");           
                return false;   
            }   
            if(content.value==""){   
                alert("内容不能为空!");          
                return false;   
            }  
         
            //return true;
     
        }  
</SCRIPT>





本文转载:CSDN博客