Getting Started with JavaScript

Source: Internet
Author: User

JavaScript, a web-based scripting language, has been widely used in Web application development, and is often used to add a variety of dynamic kinetic energy to a Web page, providing users with smoother and more beautiful browsing results. JavaScript scripts are typically embedded in HTML to implement their own functionality.
is an explanatory scripting language (the code is not precompiled).
It is used primarily to add interactive behavior to HTML (an application under the standard Universal Markup Language) page.
HTML pages can be embedded directly, but writing a separate JS file facilitates the separation of structure and behavior.

Cross-platform features, supported by most browsers, can be run on multiple platforms (e.g. Windows, Linux, Mac, Android, iOS, etc.).





After the beef brisket teacher on the basis of the explanation of JavaScript, JavaScript has some feelings, in the cloud Platform similar registration page with the most extensive, the beef brisket teacher said the example always first has a big idea, then the condition by Dahua small, then 1.1 points of debugging, Avenue to Jane's thought! the next step is to start JavaScript learning from the most basic parts.


First, JavaScript Foundation


· JavaScript framework

<strong><span style= "FONT-SIZE:18PX;" ><script language= "javascript" type= "Text/javascript" >//javascript code </script></span></ Strong>

• Popup dialog box

<span style= "FONT-SIZE:18PX;" ><strong>alert ("Hello everyone!") ");</strong></span>

• Popup input box

<strong><span style= "FONT-SIZE:18PX;" >prompt ("Please enter password:", "Default value");</span></strong>

             · Definition of custom functions in JavaScript:

<strong><span style= "FONT-SIZE:18PX;" >function function name () {//function body}</span></strong>


• Logical operators:

&& and      || or ! Take counter

<strong><span style= "FONT-SIZE:18PX;" ><strong><span style= "FONT-SIZE:18PX;" >if (expression with the result of a Boolean type) {//Expression for true statement else{//expression is a pseudo-executed statement}}</span></strong></span></strong>


• Cycle

<span style= "FONT-SIZE:18PX;" ><strong>while (loop condition) {//The JavaScript statement that needs to be cycled changes the loop initial value}</strong></span>

<strong><span style= "FONT-SIZE:18PX;" >for (loop initial value; loop add; Change loop initial value) {//JavaScript statement that needs to be looped}</span></strong>



Instance:


<span style= "FONT-SIZE:18PX;" ><strong><!doctype html>


Embed JavaScript in the web


You can insert JavaScript statements into an HTML document in the following way:
Embed statements into a document using the <script> tag
Linking a JavaScript source file to an HTML document
Use script code as an attribute value for HTML tags



Summary:


The core idea of JavaScript is to increase the user's interaction with the browser through the Web page's client-side scripting technology, and to increase the user's experience when using the Web application. with JavaScript, Web pages can do a lot of interacting. such as: After entering a text, you will be prompted to enter the correct email address, and fuzzy query also used JavaScript regular expression. The next article summarizes the regular expressions of JavaScript!



Getting Started with JavaScript

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.