A Brief discussion on javascript grammar and timing functions


1. JavaScript basic grammar.

(1) Data type and variable type. Integer, decimal, layout, string, date time, array cast: parseInt() parseFloat() isNaN()

(2) var array name = new Array([length]); // Fake array a. length- length a[subscript] = value. a [index]

(3) Function

function  The function name ( parameter )
{
}
function ShowStr(a)
{
}

2. DOM operation DOM-Document Object Model Document Object model. The tree Linear model, tree model, network model window history location document

< html > < /html > head body a,img,table,ul,ol… status

Object - object characterizes noun behavior as a verb

(1) window 1.ES60en () window.alert();

Can you run past a leopard? Why to ask ”); / / prompt (); — Not often, don’t remember, type

3. open (); open(” Address ”,“_blank/_self”,” New window features ”); [var a =] window. open (” http: / / ofstack. com ”); Open the page in a new window and return to the new window. a is also a variable of type window. Details need to be translated.

4.close(); window.close();

5.setTimeout(“code”, number of milliseconds) executes code1 after the specified number of milliseconds.

For 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 1 5 seconds after the appearance of what asked the homepage page

<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>

This is the end of this article, I hope you enjoy it.