JavaScript content Concatenation

Source: Internet
Author: User

javascript--script language Host file NetScape

JSScript Microsoft Inc.
First, JavaScript basic syntax.
(a) Data type and variable type.
Data types: Integers, decimals, booleans, Strings, datetime, arrays ...

var a=5;a=a+5; 10

var b= "5"; b=b+5; 55
Cast:
parseint () ----coerced into integers

parsefloat ()-----forcibly converted to decimals

Cases:

<script language= "JavaScript" >
var a= "15169377135o";
var b=parseint (a);
alert (b);
</script>--------15169377135

<script language= "JavaScript" >
var a= "15169377135o1234";
var b=parseint (a);
alert (b);
</script>--------15169377135

<script language= "JavaScript" >
var a= "s15169377135";
var b=parseint (a);
alert (b);
</script>--------IsNaN

IsNaN ()--------Determine if it is a valid numeric type, not (true), yes (false)

Operator: (Arithmetic operator (7) relational operator (6) logical operator (3) other operator)

Statement:  for ( var i=0,i<a.length,i++) {}
(b) Array    data type [] array name =new data type [];
var array name = new Array ([length]);//"fake" array, length suggestions are not written.
a.length----Length
a[subscript] = value.
A[]
(three) functions
Function function name (formal parameter)
{

}
Function Showstr (a)
{

}

Two, DOM operation
Dom-document object Model document.

Linear model, tree-shaped model, mesh model
Window (browser)
History---forward retreat (historical)
Location---Address bar
Document----documents, HTML pages Head
Body
A,img,table,ul,ol .....
Status-----State Bar

An object--object the characteristics of a noun, a verb (verb ()) of the Act;

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

2.[var a =]window.confirm ("Can you run over the leopard?" ");

Cases:

<script language= "JavaScript" >
var a=window.confirm ("Can you run over a leopard?") ");
if (a==true)
{
Alert ("You are more animals than animals!") ");
}
Else
{
Alert ("You beast!" ");
}
</script>


Prompt (); --infrequently used, no need to remember, input


3.open ();

var retval = window.open (URL, name, features, replace);

Replace

An optional Boolean value. Specifies whether the URL loaded into the window creates a new entry in the window's browsing history or replaces the current entry in the browsing history. The following values are supported:

    • True-url replaces the current entry in the browsing history.
    • False-url creates a new entry in the browsing history.


window.open ("Address", "_blank/_self", "new Window Features");
[var a =]window.open ("http://www.sina.com.cn");
Open the page in a new window and return to the new window. A is also a variable of window type.

var a=window.open ("http://www.sina.com.cn", "_blank", "width=200 height=200 top=0 left=0 toolbar=no");


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

5.setTimeout ("code", number of milliseconds)
Executes the code one time after the specified number of milliseconds.

Cases:

<body>
&LT;H1 id= "hh" ></body>

<script language= "JavaScript" >
function Showtime ()
{
var dt=new Date ();
document.getElementById ("hh"). Innerhtml=dt;
Window.settimeout ("Showtime ()", 1000);
}
Showtime ();
</script>
Schedules

Open the page, five seconds after the ad, and then 5 seconds ads off ************
var A;
function Openad ()
{
A = window.open ("http://www.sina.com.cn", "_blank", "width=200 height=200 toolbar=no top=0 left=0");

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

6.setInterval ("code", number of milliseconds)
Executes code once every specified number of milliseconds.
Cases:
<body>
&LT;H1 id= "hh" ></body>

<script language= "JavaScript" >
function Showtime ()
{
var dt=new Date ();
document.getElementById ("hh"). Innerhtml=dt;
}
Window.setinterval ("Showtime ()", 1000);
</script>
Schedules

Window.moveto (x, y);
Window.resizeto (width,height);
Window.scrollto (x, y);
Note: The full screen window is not visible.

(ii) Historical operations
Window.history.go (n); n is positive, forward; n is negative, backward;
(c) Address bar operations
var s=window.location.href; Get the address of the current page
Refresh the page regularly
function Showself ()
{
Window.location.href= "untitled-3.html";
}
Window.setinterval ("Showself ()", 1000);

(iv) document operations
Window.document

1. Find the Object

2. Operation Properties

3. Operation Style

4. Operation Contents

5. Operation elements.

JavaScript content Concatenation

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.