JavaScript can be said to be an essential technology in web development. It is flexible, simple and efficient. This time DRP used a lot of js, which gave me a deeper understanding of js. After watching this, I went back and watched the JS video of beef brisket. I looked at things I hadn’t seen before. Here is a summary of js. S What is JavaScript? What are the characteristics of JS? JS is an interpreted web script language. Its role is to control the behavior and content of the browser.
js code is embedded in Html.
It has several major features
It runs on the client, which means it can reduce the pressure on the server. Improve code execution efficiency.
JavaScript is an interpreted language (that is, code execution is not pre-compiled)
The corresponding compiled language needs to be compiled into intermediate code or machine language in advance during execution, such as java compiled into a .class file.
javaScript has nothing to do with java. Javascript is not a stripped-down version of other languages (it is only vaguely and indirectly related to Java, for example), nor is it a simplification of anything. However, it has its limitations. For example, you cannot use the language to write standalone applications, and there is no built-in support for reading and writing files. In addition, Javascript scripts can only run on a certain interpreter or "host", such as Active Server Pages (ASP), Internet Browser, or Windows Script Host.
What functions can JavaScript achieve?
JavaScript can implement browser script development. It has many classic features. We need to master.
JavaSript implements web page special effects
Js can implement many web page special effects, such as scrolling of picture text, dynamic transformation of pictures, etc. Searching the Internet, you can find a lot of ready-made code. In short, there are many things that you don’t need to do yourself. You need to stand on the shoulders of giants.
JavaScript operates Html elements
Js can operate web page elements, such as input boxes, drop-down boxes, tables and other elements. The basis for operating html elements is the operation of DOM objects. Any html element is a dom object. We can use js to operate it. For example, change its attributes and dynamically add elements. Get its value etc.
Each element in Html corresponds to a node in dom. The html form corresponds to a dom tree, and each node has nodeName nodeValue nodeType attributes. js operates html by operating these attributes.
Here are some operation methods.
createElement(element): Create a new element node with the specified tag name, and the return value is a reference pointer to the new element node.
createTextNode(string): Create a new text node containing the given text, and return a pointer to the new element node. Reference pointer of text node:
appendChild(node): insert node
removeChild(node): will remove a child node from a given element and return a reference pointer to the deleted child node.
hasChildNodes: used to check whether a given element has child nodes and returns a boolean value
replaceChild(newnode,oldnode): node replacement
setAttribute(key, value): add a new attribute value or change the given element node Its existing attributes
getAttribute(key): Returns the value of a given attribute node of a given element
getElementById(): Finds an element with a given id attribute value and returns an element node
getElementsByTagName(): Use To find all elements with a given tag name
As can be seen from these methods, js can flexibly add, delete, and obtain a node (html element). In this way, the operation of the form will be much more flexible.
In this drp, the main method used is getElementById().
For example:
with(document.getElementById("userform")){
action="user_maint.jsp";
method="post";
submit();
}
JavaScript implements form validation
by JavaScript Typical form data for verification include:Has the user filled in the required fields in the form?
Is the email address entered by the user legal?
Has the user entered a valid date?
Did the user enter text in the numeric field?
There are usually two ways to validate a JS form. One is to write a manual method. When the form is submitted or an event is triggered, the js method is called, and then the properties of the control are extracted through the js code to determine whether it meets the conditions. Another method is to use regular expressions to verify whether the input data conforms to a certain format. For example, the following js code for verification email
www.2cto.com
function test() <br> <br> var myreg =/^([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[ _|_|.]?)*[a-zA-Z0-9]+.[a-zA-Z]{2,3}$/; <br> <br> alert('Please enter a valid E_mail!'); <br> <br><br>The key to the code is to find the regular expression, and the second is to use this regular expression The test method is used to verify a certain string. Note that the test method comes with this regular expression. <br>JavaScript checks the customer's browser and creates cookies <br>Use javaScript to verify the user's browser version, information, etc. <br>The Navigator object below contains information about the visitor's browser, including browser type, version, etc. <br> "+ browser) document.write("<br>") <p>document.write("Browserversion: "+ version) </p> <p> <br> <br></p>

去掉重复并排序的方法:1、使用“Array.from(new Set(arr))”或者“[…new Set(arr)]”语句,去掉数组中的重复元素,返回去重后的新数组;2、利用sort()对去重数组进行排序,语法“去重数组.sort()”。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于Symbol类型、隐藏属性及全局注册表的相关问题,包括了Symbol类型的描述、Symbol不会隐式转字符串等问题,下面一起来看一下,希望对大家有帮助。

怎么制作文字轮播与图片轮播?大家第一想到的是不是利用js,其实利用纯CSS也能实现文字轮播与图片轮播,下面来看看实现方法,希望对大家有所帮助!

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于对象的构造函数和new操作符,构造函数是所有对象的成员方法中,最早被调用的那个,下面一起来看一下吧,希望对大家有帮助。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于面向对象的相关问题,包括了属性描述符、数据描述符、存取描述符等等内容,下面一起来看一下,希望对大家有帮助。

方法:1、利用“点击元素对象.unbind("click");”方法,该方法可以移除被选元素的事件处理程序;2、利用“点击元素对象.off("click");”方法,该方法可以移除通过on()方法添加的事件处理程序。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于BOM操作的相关问题,包括了window对象的常见事件、JavaScript执行机制等等相关内容,下面一起来看一下,希望对大家有帮助。

foreach不是es6的方法。foreach是es3中一个遍历数组的方法,可以调用数组的每个元素,并将元素传给回调函数进行处理,语法“array.forEach(function(当前元素,索引,数组){...})”;该方法不处理空数组。


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor
