我試圖限制用戶可以在每個輸入中輸入的內(nèi)容......除了 nothing() 函數(shù)外,一切都按計劃進行:我希望此函數(shù)允許將所有字符輸入到 onKeyDown="nothing();" 的輸入中。出于某種原因, nothing() 函數(shù)中的那些遵循與用戶名相同的布局(只有文本和數(shù)字)。請幫助它將不勝感激。謝謝你的時間..<?phpsession_start();?><html><head><title>Registration</title><link href="style.css" rel="stylesheet" type="text/css"><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script></head><body><form action="registration.php" method="post" name = "register" > <div style="width:50%; margin:auto;"> <h1>Register</h1> <p>Please fill in this form to create an account.</p> <hr> <label for="username"><b>Username:</b></label> <input type="text" placeholder="Username" name="username" pattern="[^-,]+" onKeyDown="ValidateName();" > <label style="width:50%" for="fname"><b>First Name:</b></label> <input type="text" placeholder="Enter First Name" pattern="[^-,]+" name="fname" onKeyDown="ValidateFname();"> <label for="lname"><b>Last Name:</b></label> <input type="text" placeholder="Ender Last Name" pattern="[^-,]+" name="lname" onKeyDown="ValidateLname();"><br><br> <label for="dob"><b>Date of Birth</b></label> <input type="date" placeholder="" name="dob"> <br><br> <label for="ingame"><b>In Game Name:</b></label> <input type="text" placeholder="Enter In Game Name" name="ingame" onKeyDown="ValidateIGN();"> <label for="email"><b>Email</b></label> <input type="text" placeholder="Enter Email" name="email" pattern="[^-,]+" onKeyDown="nothing()"> <label for="pw"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="pw" pattern="[^-,]+" onKeyDown="nothing()"> <label for="psw-repeat"><b>Confirm Password</b></label> <input type="password" placeholder="Repeat Password" name="confpw" pattern="[^-,]+" onKeyDown="nothing()"> <button onclick="" name="register" type="submit" class="register">Register</button> </div>
如何允許所有字符類型進入輸入
繁華開滿天機
2021-10-29 16:04:52