Basic JavaScript Learning

Source: Internet
Author: User

<--Directory--

1. js existence form and other

2. Functions

3. Self-executing function

4. Jquery3 Add Event

5. jquery Auto-increment style

6. Back to Top

7. Scroll bar

8. Happy Lantern

9. Search box


JS existence form and other

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


function. js

Alert (' Yang over ');//This is a single-line comment/* This is a multiline comment name=123 global variable setting var name=123 local variable setting * *///function variable, function declaration, function return Value name = ' 123 ' tes = ' test1 ' Foo (' wsyht1 ', ' wsyht2 ', ' wsyht3 ')//Assignment 1th, 2, 3-bit parameter bar () Bat () function Foo (name1,name2) {//pass 1th, 2-bit parameter var name3 = arguments[2];  var name4 = arguments[3];    Declaration of 3rd, 4-bit parameters, Console.log (name1) is not recommended, Console.log (name2); Console.log (Name3); Console.log (NAME4); Add a semicolon to write multiple statements, output 3, 4-bit parameters, the fourth bit is not assigned, then the output does not define return Console.log (NAME1);} function Bar () {tes = ' test2 '; console.log (name); Console.log (TES);}  function Bat () {var name = ' 456 '; console.log (name); }


Self-executing functions

/*var temp = function () { //anonymous function}*///self-executing function, no call, self-execution/* (function () {Console.log (' hello  World ');}) () *//* (function (name) {console.log (name);}) (' Wsyht ') *///declares an array//var arry = arry (12,3,4,5)/*var arry = [1,2,3,4]arry.push (' Wsyht '); Console.log (Arry); Arry.unshift (' wsy '); Console.log (Arry); Arry.splice (1,0, ' HT ');    // After 1 inserting the number ok,0 represents the insertion does not delete the meaning of  console.log (Arry); Arry.splice (100,0, ' OK ');  //inserts a number after 100 ok,0 represents the insertion does not delete the meaning of   Console.log (Arry); *///a = [1,2,3]//a[10] = 9//a//names = [1,22,33,44,55,66]// Names.slice (1,5)  //all digits following the 1th digit//dic = {' name ': ' Wsyht ', ' age ': 18}//dic = {' name ': {' xx ': ' Oo '}, ' age ': 18}//the first for loop var array = [11,22,33,44,55]var dict = {' name ': ' Wsyht ', ' Age ': 19}/*for (Var item in array) {Console.log (item)}for (var item in dict) { Console.log (Dict[item])}*///the second type for loop/*for (var i=0;i<array.length;i++) {Console.Log (Array[i]);} for (var i=0;i<10;i++) {Console.log (dict[i]);} */


JS Add Event

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


JS Auto-increment style

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


JS back to Top

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


JS scroll bar

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


JS Racing Light

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


JS search box

<! doctype html public  "-//w3c//dtd html 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd ">


This article is from the "Wsyht90 blog" blog, make sure to keep this source http://wsyht90.blog.51cto.com/9014030/1854664

Basic JavaScript Learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.