Learning JavaScript from scratch

Source: Internet
Author: User

In millions of Internet pages, JavaScript is used to improve design, verify forms, detect browsers, and create cookies. Javascript is the most popular scripting language on the Internet and can be run in all major browsers, for example, Internet Explorer, Mozilla, Firefox, Netscape, and opera ".


Javascript is a scripting language based on object and event-driven with secure performance. This language is used with HTML hypertext markup language, Java Applet (Java smallProgram) Link multiple objects in a web page to interact with Web customers, so as to develop client applications. So we need to learn JavaScript.


(1) JavaScript is a scripting language.

(2) JavaScript is an object-based language.

(3) JavaScript is simple.

(4) JavaScript has high security.

(5) JavaScript is dynamic and can respond directly to user or customer input without passing through web service programs.

(6) JavaScript is cross-platform.


 In the HTML documentMedium, two typesProgramming Language,JavascriptUse"<SCRIPT>... </SCRIPT>"AndJavaUse"<APPLET>... </APPLET>".


Javascript can be embedded in HTML in multiple ways:

(1) embedded in the HTML webpage Header

(2) embedded in an HTML webpage

(3) embedded in element events of HTML Web pages

(4) calling existing JavaScript files in HTML

 

Example 1 tell the user

 
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> JavaScript tutorial </title>
<! -- Script -->
<SCRIPT type = "text/JavaScript">
What_to_say = "hello ";
Alert (what_to_say );
</SCRIPT>
</Head>
<Body style = "overflow: auto;">
</Body>
</Html>

 

The prompt "Hello!" appears !"

 

 

Example 2 whether the prompt time is displayed

 
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> Hello </title>
</Head>
<Body style = "overflow: auto; padding: 0px; margin: 0px;">
<Div style = "font-size: 14px; font-weight: bold; color: #000; font-family: Arial,; Background-color: # e3e3e3; padding: 4px 10px; ">
User: Hello
<SCRIPT>
If(Confirm ("do you need to display the time? ")){
Dt =NewDate ();
Document. Write (", current time is ");
Document. Write (Dt. tolocaletimestring ());
}
</SCRIPT>
</Div>
</Body>
</Html>

 

The message "do you need to display the time?" appears ?"

 

When we click yes, the time will appear.

 

In fact, no matter what language it is, you must write it by yourself and use it by yourself to understand how to use it.

This JavascriptThis is the end.Let's learn JavaScript from scratch

The dream is always out of reach. We can only make progress towards the dream.

This year is the year of the dragon in China! Start with your dream...

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.