html部分:
<code class="language-html"> <meta charset="UTF-8"> <title>formValidator</title> <script src="js/jquery-1.11.1.js"></script> <script src="js/formValidator-4.0.1.min.js"></script> <script src="js/DateTimeMask.js"></script> <script src="js/formValidatorRegex.js"></script> <link rel="stylesheet" href="css/validator.css"> <style> form{ width: 500px; margin: 100px auto; } table tr td:first-child{ text-align: right; } table tr td{ padding: 5px 0; } div{ margin-left: 10px; padding: 0 10px; } </style> <form name="myfm" id="myfm" action="1.html"> <table> <tbody> <tr> <td><label for="uname">用户名:</label></td> <td><input type="text" id="uname" name="uname"></td> <td><div id="unameTip"></div></td> </tr> <tr> <td><label for="pwd">密码:</label></td> <td><input type="password" id="pwd" name="pwd"></td> <td><div id="pwdTip"></div></td> </tr> <tr> <td><label for="repwd">重复密码:</label></td> <td><input type="password" name="repwd" id="repwd"></td> <td><div id="repwdTip"></div></td> </tr> <tr> <td><label>性别:</label></td> <td> <input type="radio" name="sex" value="male" id="male"> <label for="male">男</label> <input type="radio" name="sex" value="female" id="female"> <label for="female">女</label> </td> </tr> <tr> <td><label for="area">地区:</label></td> <td> <select name="area" id="area"> <option value="0">- 请选择 -</option> <option value="1">锦江区</option> <option value="2">金牛区</option> <option value="3">龙泉驿区</option> <option value="4">青羊区</option> </select> </td> </tr> <tr> <td><label for="num">身份证:</label></td> <td><input type="text" id="num" name="num"></td> <td><div id="numTip"></div></td> </tr> <tr> <td><label for="phone">电话号码:</label></td> <td><input type="text" name="phone" id="phone"></td> <td><div id="phoneTip"></div></td> </tr> <tr> <td><label for="email">邮箱:</label></td> <td><input type="text" name="email" id="email"></td> <td><div id="emailTip"></div></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" id="submit" value="提交"></td> <td></td> </tr> </tbody> </table> </form> <script> $.formValidator.initConfig({ //用于配置当前formValidator插件 formID: "myfm", debug: false, submitOnce: true, validatorGroup: '1', //设置验证组,默认值为1 onSuccess: function() { //验证成功后的回调函数 }, onError: function() { //验证失败后的回调函数 } }); $('#uname').formValidator({ ValidatorGroup: '1', //验证组为1 onEmpty: '用户名不能为空', //提示用户名不能为空 onShow: "", onFocus: '用户名必须为1到12位的数字或字母', //表单元素获得焦点的时候提示应输入的格式 onCorrect: '用户名输入正确' //输入正确的提示 }).regexValidator({ regExp: '^[0-9a-zA-Z]{1,12}$', //验证表单输入的正则表达式 onError: '用户名格式有误,请从新输入' //输入错误的提示 }).ajaxValidator({ //验证输入的用户名是否已经存在 dataType: 'html', //请求数据的格式 async: true, //异步方式 url: 'test.php', success: function(data) { if (data == 'false') { return false; } else { return true; } }, onError: '该用户名已存在,请从新输入', onWait: '正在对用户名进行合法性校验,请稍候...' }); $('#pwd').formValidator({ ValidatorGroup: '1', onEmpty: '密码不能为空', onShow: "", onFocus: '密码必须为6位以上的字母或数字', onCorrect: '密码输入正确' }).regexValidator({ regExp: '[0-9a-zA-Z]{6,}', onError: '密码格式有误,请从新输入' }); $('#repwd').formValidator({ ValidatorGroup: '1', onEmpty: '密码不能为空', onShow: "", onFocus: '密码必须为6位以上的字母或数字', onCorrect: '密码输入正确' }).regexValidator({ regExp: '^[0-9a-zA-Z]{6,}$', onError: '密码格式不正确' }).compareValidator({ //比较两次输入内容是否符合下面给出的比较符号 desID: 'pwd', //相比较的表单元素的ID值 operateor: '=', //要比较的两个元素之间的关系 onError: '两次密码输入不一致,请从新输入' //不满足以上关系的时候的提示 }); $('#num').formValidator({ ValidatorGroup: '1', onEmpty: '身份证不能为空', onShow: '', onFocus: '请输入您的身份证号', onCorrect: '身份证格式正确' }).regexValidator({ regExp: '^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{4}$', //15位身份证号码的正则表达式/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/ onError: '身份证格式有误,请从新输入' }); $('#phone').formValidator({ ValidatorGroup: '1', onEmpty: '手机号码不能为空', onShow: '', onFocus: '请输入您的手机号码', onCorrect: '手机号码格式正确', }).regexValidator({ regExp: '^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$', onError: '手机号码格式有误,请从新输入' }); $('#email').formValidator({ ValidatorGroup: '1', onEmpty: '邮箱地址不能为空', onShow: '', onFocus: '请输入您的邮箱地址', onCorrect: '邮箱格式正确' }).regexValidator({ regExp: '^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$', onError: '邮箱格式有误,请从新输入' }); </script> </code>
php部分代码:
<code class="language-php"><?php header('Content-Type:html'); $name=array('Tom','ervin','Jhon'); $uname=$_REQUEST['uname']; $notexit='true'; for ($i=0; $i <3 ; $i++) { if ($uname==$name[$i]) { $notexit='false'; break; }else{ } } echo "$notexit"; ?></code>

JavaScript is at the heart of modern websites because it enhances the interactivity and dynamicity of web pages. 1) It allows to change content without refreshing the page, 2) manipulate web pages through DOMAPI, 3) support complex interactive effects such as animation and drag-and-drop, 4) optimize performance and best practices to improve user experience.

C and JavaScript achieve interoperability through WebAssembly. 1) C code is compiled into WebAssembly module and introduced into JavaScript environment to enhance computing power. 2) In game development, C handles physics engines and graphics rendering, and JavaScript is responsible for game logic and user interface.

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment