Home  >  Article  >  Web Front-end  >  A preliminary understanding of JavaScript

A preliminary understanding of JavaScript

高洛峰
高洛峰Original
2016-11-26 13:21:431292browse

1. History of JavaScript
In the past, the Internet speed was relatively slow, and web page form verification and other operations needed to be performed on the server, which would take a long time, so Netscape invented a client-side scripting language called JavaScript.
The content below is also from the website above.

2. What is JavaScript?
JavaScript is designed to add interactive behavior to HTML pages.
JavaScript is a scripting language (a scripting language is a lightweight programming language).
JavaScript consists of several lines of executable computer code.
JavaScript is often embedded directly into HTML pages.
JavaScript is an interpreted language (that is, code execution is not precompiled).
Everyone can use JavaScript without purchasing a license.

3. What can JavaScript do?
JavaScript provides a programming tool for HTML designers
HTML creators are often not programmers, but JavaScript is a scripting language with an extremely simple syntax! Almost everyone has the ability to put short snippets of code into their HTML pages.
JavaScript can put dynamic text into an HTML page
A JavaScript statement similar to this can put a variable piece of text into an HTML page: document.write("

" + name + "

")
JavaScript can respond to events
JavaScript can be set to be executed when an event occurs, such as when the page is loaded or when the user clicks on an HTML element.
JavaScript can read and write HTML elements
JavaScript can read and change the content of HTML elements.
JavaScript can be used to validate data
JavaScript can be used to validate data before it is submitted to the server.
JavaScript can be used to detect the visitor's browser
JavaScript can be used to detect the visitor's browser and load the corresponding page for the browser based on the detected browser.
JavaScript can be used to create cookies
JavaScript can be used to store and retrieve information located on the visitor's computer.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn