JS Strings and Control statements

Source: Internet
Author: User

string of 1.js

* String
* string is one of the JS data types
* string concatenation: +, plus has two meanings
* 1, the addition operation in mathematics;
* 2, string connection, when the plus sign on either side is a string, that is the meaning of the string connection;

<! DOCTYPE html>

Process Control in 2.js

* Demand
* when clicked, let box toggle between show and hide
Analysis
* 1, get the button, box
* 2. Add a Click event to the button
* Depending on the display property of box
* If box is displayed, let it hide
* If it's a shadow, let it show
*
* Style It operates inline style, preferably do not use inline style, otherwise it will make HTML particularly bloated

<! DOCTYPE html>

* Demand: Click on the Next button, let the image switch to the next picture
* Click on the previous photo to switch the image to the previous picture
Analysis
* 1, get to the Next button
* 2. Add a Click event to the button
* A, using the property operation method to modify the image src;
* B, put the number in a variable, click on the next one, let this variable add 1. The method of string concatenation is used to modify the SRC attribute of the image;
*
* Cumulative
* n=n+1
* n+=1;
* n++;
<! DOCTYPE html>

 

The following example describes document processing

* Requirements: Click on the button to display the contents of the input box
*
Analysis
* 1, analysis to buttons, text box, box
* 2. Add a Click event to the button
* A, get user input content (text and Vlue)
* B. Display the Acquired content in box
<! DOCTYPE html>

JS Strings and Control statements

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.