current position:Home>A simple smart form cannot get the property "tolowercase" that is undefined or null referenced

A simple smart form cannot get the property "tolowercase" that is undefined or null referenced

2022-01-26 23:07:28 CSDN Q & A

Need to make a smart form , But it has not met the requirements , Excuse me, where is the code problem ?

img

<!doctype html><html><head><meta charset="utf-8"><title> Untitled Document </title><script><!--function registerform(){ if(nameCheck()&&passwordCheck()&&emailCheck()) return true; else return false;}function nameCheck(nameId){ var name=document.myform.txtName.value; if(name.length!=0){ for(var i=0;i<name.length;i++){ var str=nameId.toLowerCase().charAt(i); if(!((str>="a"&&str<="z")&&(str>="0"&&str<="9")||str=="_")){ console.log(" The member name input format is incorrect "); return false; } } return true; }}function passwordCheck(){ var password=document.myform.txtPassword.value; if(password.length<6){ console.log(" Password must be more than 6 Characters .\n"); document.myform.txtPassword.value=""; document.myform.txtPassword.style.color="red"; return false; } return true; }function emailCheck(){ var email=document.myform.txtEmail.value; if(email.indexOf(".",0)==-1){ console.log(" The email format is not correct \n Must contain characters ."); return false; } return true; }//--></script></head><body>    <form name="myform" onsubmit="registerform( );" method="post">        <table>            <tr>                <td> Member name :</td>                <td><input type="text" id="txtName" required>( Can contain  a-z、0-9  And the underline )</td>            </tr>            <tr>                <td> password :</td>                <td><input type="password" id="txtPassword" required>( Include at least  6  Characters )</td>            </tr>            <tr>                <td> mailbox :</td>                <td><input type="email" id="txtEmail" required>( Include at least  6  Characters )</td>            </tr>            <tr>               <td>                    <input type="reset" value=" Reset " id="txtReset">                </td>                <td>![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/236310536936129.png "#left")                    <input type="submit" value=" Sign in " id="txtRegister">                </td>            </tr>        </table>    </form></body></html>



Refer to the answer 1:

You use regular Is it not fragrant ?




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262307264573.html

Random recommended