.


:




:

































 

 

 

 


Array, Date, Math




Array

. length, , .

:

concat ([item1: { Object | Array } [,... [, itemN: { Object | Array }]]]]): Array , ;

join (separator: String): String , , ;

pop (): Object ;

push ([item1: Object [,... [, itemN: Object]]]): Number ; , ;

shift (): Object ;

sort (sortFunction: Function): Array ;

unshift ([item1: Object [,... [, itemN: Object]]]): Array .

Date

Date .

Date . Date , , 1 1970 . , , .

Date :

function Date([dateVal: { Number | String } ]) , 1 1970 ; , "month dd, yyyy hh:mm:ss";

function Date(year: int, month: int, date: int[, hours: int [, minutes: int [, seconds: int [, ms: int]]]]) , , .

Date , .

Date. set . get, Date.

setDate (numDate: Number) , , , numDate . , 10 2008 setDate() 33, 2 2008 . setDate() , ;

setFullYear (numYear: Number [, numMonth Number [, numDate Number]]) , ;

setHours (numHours: Number [, numMin: Number [, numSec: Number [, numMilli: Number ]]]) , , ;

setMilliseconds (numMilli: Number) ;

setMinutes (numMinutes: Number [, numSeconds: Number [, numMilli: Number]]) , ;

setMonth (numMonth: Number [, dateVal: Number]) , ;

setSeconds (numSeconds: Number [, numMilli: Number]) , ;

setTime (milliseconds: Number) , 1 1970 .

parse, . MSDN Library.

<!-- # 3: . Date -->

<html> <head>

<title>Clock</title>

<script type="text/JavaScript">

function clockform()

{d=new Date();

time=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();

document.formcl.fclock.value=time;

setTimeout("clockform()",100); }

</script>

</head>

<body onLoad="clockform()">

<center>

<form name=formcl metod="get">

<input name=fclock maxlength=8 size=8>

</form> </center>

</body></html>

Math

Math , .

Math, -
.

:

alert(Math.pow(10,3));

// 1000

<!-- # 4: -->

<html>

<head>

<title> </title>

</head>

<body>

<script type="text/javascript">

function sq(r) {

document.write(" r= ", r,

" .","<BR>")

return Math.PI*r * r;

}

var r=2;

document.write(" ",sq(r),".")

</script>

</body> </html>

window document

JavaScript , (window, navigator, location ..) , HTML- (document, forms, frames ..);

, .

window JavaScript. self window . , window.close() self.close(). top , parent , frameset. , window.open() window.close() open() close(), close()

window.open() .

<!-- # 5: -->

<html> <head>

<title> </title>

<script type="text/JavaScript">

function makeicon()

{

window.open("pr1.htm","icon", //

"resizable=yes,scrollbars=yes,width=50,height=70");

window.close(); //

}

</script>

</head><body>

<h1>minimize page</h1>

<form name=formicon>

<input name=ibutton type=button value=mini onClick="makeicon()">

</form>

</body></html>

open() web-. :

[windowVar=][window].open("URL", "winName", "windowFeatures"])

windowVar ; URL URL, ; winName ; windowFeatures :

toolbar [=yes | no] , "Back" "Forward";

location [=yes | no] Location;

directories status [=yes | no] ;

menubar [=yes | no] ;

scrollbars [=yes | no] , , ;

resizable [=yes | no] ;

width =pixels, height =pixels .

. !

window: document, frame, location.

: alert(), confirm(), prompt(), open(), close(), setTimeout(), ClearTimeout(). : onLoad, onUnload.

opener, , blur focus . opener , . . , , : window.opener.[method]. , -, close(): window.opener.close()

-. , - : window.opener.document.bgColor ='cyan'

-:

window.opener= new_window

Document

Document , . all, .

<!-- # 6: -->

<html> <head>

<title> </title>

<script type="text/javascript">

function findtags()

{var tag;

var tags=" ";

for(i=0;i<document.all.length;i++)

{tag=document.all(i).tagName;

tags=tags+"\r"+tag;}

alert(tags);

return tags;}

</script>

</head>

<body onload="findtags()">

<h2 onMouseover="findtags()">

</h2>

</body> </html>

<!-- # 7: - bgColor Document -->

<html> <head>

<title>bgcolor</title>

</head>

<body text=000000 bgcolor=ffffff>

<table border=0 align=center>

<tr><td><form>

<input type=button value=""

onClick= "document.bgColor ='ff0000'" >

<input type=button value=""

onClick="document.bgColor ='ffff00'">

<input type=button value=""

onClick="document.bgColor= '0000ff'">

<input type=button value=""

onClick="document.bgColor= '87ceeb'">

</form></td>

</table>

</body> </html>





:


: 2016-04-03; !; : 427 |


:

:

- , - .
==> ...

1490 - | 1410 -


© 2015-2024 lektsii.org - -

: 0.029 .