JavaScript Learning Note 1

Source: Internet
Author: User

  I. JavaScript INTRODUCTION

JavaScript is also known as JS, mainly responsible for the browser animation and other effects. Now the General browser is compatible with JS (IE6.7.8 may not be compatible with some usage).

  Two. JS Common statements

  1.document.write ();

Can be used directly with the HTML output stream, that is, the ability to directly in the Web page content output.

Instance:

  2.alery ();

Web page bullets//No click on the page to do the next step

Instance:

  

  3.confirm ();

message dialog box, Web page frame information user Click after the judgment, often used in the user to choose.

Instance:

  

  4.prompt ();

A message dialog box, often used to communicate information to a user.

Instance:

  

  5.window.open (opens a new window) with Window.close (Close window)

Grammar:

Open window: window.open ([url],[window name],[window parameter]);

Close window: Window.close ();//close this window

< Window object >.close ();//close specified window

   6. Get the tag ID

Syntax: document.getElementById ("id");

Instance:

  

  7.innerHTML

Used to get or replace HTML element content.

Syntax: object.innerhtml

Instance:

  

  8. Use JS to modify the style of HTML elements

Syntax: Object.style.property=new style;

Instance:

  

  9.display//Show or hide

Grammar:

Object.style.display = value

Value:

onoe;//Hidden

block;//Display

Instance:

  

  10. Control class Name (classname property)

Gets the class property of the element, specifying a CSS style for an element of the page to change the appearance of the element.

Grammar:

Object.classname = ClassName

Instance:

  

JavaScript Learning Note 1

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.