Home  >  Article  >  Web Front-end  >  What is JavaScript? How to use JavaScript?

What is JavaScript? How to use JavaScript?

黄舟
黄舟Original
2017-11-09 14:05:351802browse

What is JavaScript? How to use JavaScript? For beginners, the first step is to understand these. So today our php Chinese website will introduce to you what JavaScript is? And the usage of JavaScript~


## 1. What is javascript?

##JavaScript is a client-side browser-based, object-oriented, ## developed by Netscape. #Event

Driven web scripting language. JavaScript is a scripting language developed from Netscape's LiveScript to improve compatibility with Java. JavaScript uses HTML pages as its interface.

JavaScript is a literal scripting language that is a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML (an application under Standard Universal Markup Language) web pages to add dynamic functions to HTML web pages. .

1. What are the characteristics of JavaScript

##JavaScript makes web pages more interactive. JavaScript simplifies regularly repeated HTML segments, reducing download times. JavaScript can respond to user operations in a timely manner and perform instant checks on submitted forms without wasting time on CGI verification. The features of JavaScript are endless, as long as you get creative.

2. What software should be used to develop JavaScript

A JavaScript program is actually a document, a text file. It is embedded into the HTML document. Therefore, any software that can write HTML documents can be used to develop JavaScript. Here I recommend that you use the Microsoft Script Editor that comes with FrontPage 2000 (in FrontPage menu | Tools | Macros | Microsoft Script Editor). It is a program developer like Visual Basic / C++ that can give brief prompts for the statements being entered. With FrontPage 2000, the workload is greatly reduced.

2. Usage of Javascript on web pages

##There are two ways to add Javascript to a web page:

1. Directly add HTML document

this Is the most commonly used method, most web pages containing Javascript use this method, such as:

<script language="Javascript">
<!--
document.writeln("这是Javascript!采用直接插入的方法!");
//-Javascript结束-->
</script>

In this example, we can see a new tags: 3f1c4e4b6b16bbbd69b2ee476dc4f83a...2cacc6d41bbb37262a98f745aa00fbf0, and ee7daa49a56abfe5e8409b7b65ffb3c0 is used to tell the browser that this is a program written in Javascript, and the corresponding interpreter needs to be mobilized for interpretation.

HTMLComment

tags 64319fc22de3df1e5972a1902b476065: used to remove Javascript source code that the browser cannot recognize. This is useful for browsers that do not support the Javascript language. It's very useful.

//-End of Javascript: Double slashes indicate the comment part of Javascript, that is, characters from the beginning of // to the end of the line are ignored. As for the documents used in the program. The write() function means to output the text in the brackets to the window, which will be introduced in detail later. Another point to note is that the position of 3f1c4e4b6b16bbbd69b2ee476dc4f83a...2cacc6d41bbb37262a98f745aa00fbf0 is not fixed and can be included in 93f0f5c25f18dab9d176bd4f6de5d30e...9c3bca370b5104690d9ef395f2c5f8d1 or 6c04bd5ca3fcae76e30b72ad730ca86d.. ...36cc49f0c466276486e50c850b7e4956 anywhere.

2, Reference

Method If there is already a Javascript source file (with js extension), you can use this reference method to improve the utilization of the program code. The basic format is as follows:

<script src=url language="Javascript"></script>

The Url is the address of the program file. Likewise, such statements can be placed in the head or any part of the body of an HTML document. If you want to achieve the effect of the example given in the "Direct Insertion Method", you can first create a Javascript source code file "Script.js" with the following content:

document.writeln("这是Javascript!采用直接插入的方法!");
You can call the program like this in the web page:
<script src="Script.js" language="Javascript"></script> 。

Related recommendations:

1.What is JavaScript_Basic knowledge

2.What are the initialization expressions of javascript objects and arrays?

3.Tell you what is the callback function of javascript_Basic knowledge

The above is the detailed content of What is JavaScript? How to use JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

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