SoFunction
Updated on 2025-04-06

JS judges that it cannot be empty instance code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
<title>SMS System</title>
<script language="javascript">       
        function formcheck(){
            if(==""){
alert("The number cannot be empty!");
                this.();
                return false;
            }else if(==""){
alert("Content cannot be empty!")
                this.();
                return false;
            }else (); 
}
        </script>
    </head>

    <body>
        <form name="form" method="post" action="" class="formg">
            <table>
                <h2>
                    <tr>
<th colspan="8" class="CTitle">Send SMS</th>
                    </tr>
                </h2>

                <body>

                        <tr bgcolor="#eeeeee">
<td align="center">number&nbsp;&nbsp;&nbsp;&nbsp;code:</td>
                            <td><textarea name="content" cols="80" rows="15" class="formh"></textarea></td>
                        </tr>
                        <tr bgcolor="#eeeeee">
<td align="center">Inside the list:</td>
                            <td><textarea name="content" cols="80" rows="15" class="formh"></textarea></td>
                        </tr>

                        <tr bgcolor="#eeeeee" align="center">
                <td height="25" colspan="2">
<input type="button" name="Submit" value="Send" class="button" onClick="javascript: formcheck();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="Submit2" value="reset" class="button">
                </td>
                        </tr>
                </body>
            </table>
        </form>
    </body>
</html>