Home > Web Front-end > JS Tutorial > Detailed introduction to writing methods and comments in JavaScript

Detailed introduction to writing methods and comments in JavaScript

黄舟
Release: 2017-11-01 10:19:36
Original
2247 people have browsed it

JavaScript is the script language that runs on the browser side. JavaScript mainly solves the problem of Issues with front-end interaction with users, includingUsing interaction to interact with data. JavaScript is interpreted and executed by the browser. The front-end scripting language also includes JScript (unique to Microsoft and IE), ActionScript( Adobe company, plug-in required), etc.

Three blocks of front-end

1. HTML: page structure 2. CSS: page performance: element size, color, position, hiding or showing, parts

AnimationEffect 3. JavaScript: PageBehavior: Some animation effects, interaction between the page and the user, page functions

Three ways to write JavaScript: embedded - external link - inline

Inline:

*

Write directly inside the tag"

onclick="alert('helloworld')""Embedded (embedded)

*

Writing method" <script><span style="font-family:Consolas; color:red; background:#F7F7F7"><strong> alert('hello world')</script>

"* ##Note:

scriptCan be anywhere in html

External link style

1.

Create

js File,Write jscode inside the file2. Pass " ##>

" 3. **Note:** You cannot write js code in the file tag that loads js;If you need to add "<script></script>"

Comments of js

  1. ## are divided into single-line comments and multi-line comments

  2. Single-line comments//

  3. Multi-line comments/ Content to comment /

The above is the detailed content of Detailed introduction to writing methods and comments in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template