"JavaScript" note 01--making Stuff happen???

Source: Internet
Author: User

While, generally speaking, HTML is forContent and CSS is forPresentation, JavaScript is forInteractivity.

1. From HTML to JavaScript, like this:

<! DOCTYPE html>        <script>            alert ("Hello, World");        </script>    </body>

Alert means a warning, similar to a message. The effect is to pop up a dialog box.

2. Referring to the external. js File

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "UTF-8">        <title></title>    </Head>    <Body><script src= "script.js" ></script>    </Body></HTML>

Script.js

Alert ("Hello, World");

3, running JavaScript code in the browser console, chrome access to the console shortcut key is F12

4, before the formal start of study, need to emphasize is:

A Browser then runs JavaScriptLine-by-line, starting at the top of the file orscriptElement and finishing at the bottom (unless-it to go elsewhere).

5, ask the user last name of the small program

<! DOCTYPE html>      var surname = prompt (' Greetings friend, May I enquire as to your surname? ');         </script>    </body>

Running this code through the browser will jump out of a "small box" and ask for your last name.

6, the variable is similar to a "box", we use it to store data; it has "name" and "value".

Statement (Declaration)

var surname; var age;

Initialize (initialization)

var name = "Tom";

Assign Value (Assignment)

Name = "Andy"= 43;

"JavaScript" note 01--making Stuff happen???

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.