Home > Web Front-end > JS Tutorial > body text

Compilation of javascript basic knowledge_Basic knowledge

WBOY
Release: 2016-05-16 18:25:48
Original
1394 people have browsed it

1 Create script block
Program code

Copy code The code is as follows:



2 Hide script code
Program code

[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

In browsers that do not support JavaScript The relevant code will not be executed in the browser3. When the browser does not support it, it will be displayed

Program code The code is as follows:




4 Link external script files

Program code The code is as follows:



5 Comment Script

Program Code The code is as follows:


// This is a comment
document. write("Hello"); // This is a comment
/*
All of this
is a comment
*/

6 output to Browser

Program code The code is as follows:


document. write("Hello jb51 .net");

7 Define variables

Program code The code is as follows:


var myVariable = "some value";


8 String addition

Program code The code is as follows:


var myString = "String1" "String2";


9 String search

Program code

[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]
10 string Replace
program codeCopy code
The code is as follows:

thisVar.replace ("Monday","Friday");

11 Format string
Program code
[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]
12 创建数组
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

13 数组排序
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

14 分割字符串
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

15 弹出警告信息
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

16 弹出确认框
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

17 自定义函数
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

18 调用JS函数
程序代码
复制代码 代码如下:

19 在页面加载完成后执行函数
程序代码
复制代码 代码如下:


Body of the page


20 条件判断
程序代码

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

21 specified times of loop
Program code

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]
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