On the _javascript skills of JavaScript grammar and timing function

Source: Internet
Author: User

First, JavaScript basic syntax.

(i) Data type and variable type. Integer, Decimal, Layout, string, date time, array cast: parseint () parsefloat () isNaN ()

(ii) array var array name = new Array ([length]); "Counterfeit" array a.length-length a[subscript] = value. a[Subscript]

(iii) function

Copy Code code as follows:

function functions name (formal parameter)
{
}
function Showstr (a)
{
}

Second, Dom operation
Dom-document object Model Document objects. Tree
Linear model, tree-like model, mesh model
Window
History
Location
Document

Head
Body
A,img,table,ul,ol .....
Status

The verb of noun behavior--object characteristic of object

(i) window 1.alert () Window.alert ();

2.[var a =]window.confirm ("Can you run through the leopard?") Where to ask "); Prompt (); --not used, don't remember, enter

3.open (); Open ("Address", "_blank/_self", "features of the new Window"); [var a =]window.open ("http://jb51.net"); Open the page in a new window and return to the new window. A is also a variable of type window. Detailed translation is required.

4.close (); Window.close ();

5.setTimeout ("code", number of milliseconds) after the specified number of milliseconds, execute the code once.

Example

<script language= "javascript" >

function showTime ()
{
var date = new Date ();
document.getElementById ("hh"). InnerHTML = date;
Window.settimeout ("ShowTime ()", 1000);

}
Window.settimeout ("ShowTime ()", 1000);
</script>

Practice
Do a page in 5 seconds after the first page of the question

<script language= "JavaScript" >

var A;
function Openad ()
{
a = window.open ("http://hovertree.com", "_blank", "width=200" height=200 toolbar=no top=0 Left=0 ");

Window.settimeout ("Closead ()", 5000);
}
function Closead ()
{
a.close ();
}
Window.settimeout ("Openad ()", 5000);

</script>

The above mentioned is the entire content of this article, I hope you can enjoy.

Related Article

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.