> open (), write (), close (). ,.
. , JavaScript. , Button (INPUT button - ) click, ... INPUT click - onClick. , JavaScript HTML -:
lt; INPUT TYPE=button VALUE= onClick= window. alert ( laquo ;, ); gt;
,. , BODY, onLoad.
. ,, Internet Explorer, Netscape Navigator Opera,.
(),..
URL (Uniform Resource Locator) - Web -. Web URL.
URL HREF A, SRC IMG, ACTION FORM .. URL,,, FTP- ftp, Gopher- - gopher, - smtp. URL: lt; # justify gt; 1. HTML-;
2. HTML-.
,,.- JavaScript-.
-. JavaScript Window, ... ,,:
, JavaScript ().. function,,. , JavaScript-.
JavaScript. ,. , Window Document location. Window Location, Document -, URL.
,.
,: toString (). location, window. location,,:
lt; SCRIPT gt ;. write (window. location) ;. write ( lt; BR gt; ) ;. write (document. location);
lt;/SCRIPT gt;
-,.
:
lt; SCRIPT gt;=toString (window. location);=toString (document. location);=window. location. href ;. write (w. length) ;. write (d. length) ;. write (h. length);
lt;/SCRIPT gt;
.
, URL, location,.
Window - JavaScript. Window Frame.
Window -, Frame -, HTML- FRAMESET FRAME.
JavaScript. JavaScript,:
myString= Hello World! raquo ;; myString=new String ( Hello World! );
. ,.:
n=5; s=new String (n * 20);
s" 100. s n * 20, s 100. JavaScript,,.
(var n=new String ( Hello World )) Internet Explorer, (var n= Hello World ).. ,.
, eval ().
,?:
n= The dog took it s bone outside ';
, it s . The dog took it raquo ;, s bone outside raquo ;. JavaScript (,), [15].
. ,.. , . JavaScript,,,,.
n= The dog took it's bone outside raquo ;; n= The dog took it 's bone outside raquo ;;
,: ''.
indexOf lastIndexOf.
,. indexOf,. , IndexOf - 1. lastIndexOf indexOf,,.
, indexOf lastIndexOf - 1,, -,.
.
· charAt (),.
Test raquo ;. charAt (1)= e .
· length. Test raquo ;. length=4.
· substring (). Test raquo ;. substring (1,2)= e raquo ;.
· substr () substring (),,. , Substr ().
· Test raquo ;. substr (1,2)= es raquo ;;
· toLowerCase () toUpperCase (),:.
Test raquo ;. toUpperCase ()= TEST raquo ;;
:
( This is a Test raquo ;. indexOf ( T ));// 0 ( This is a Test raquo ;. lastIndexOf ( T ));// 10 ( This is a Test raquo ;. charAt (5));// I ( This is a Test raquo ;. length);// 14 ( This is a Test raquo ;. substring (5,9));// Is a ( This is a Test raquo ;. substr (5,9));// Is a Test ( This is a Test raquo ;. toUpperCase ());// THIS IS A TEST ( This is a Test raquo ;. toLowerCase ());// This is a test
,, eval (). eval (), JavaScript.
( alert ( Hello World! ) );
Hello World! raquo ;, alert. ,,.
Math JavaScript,,. Math. PI,, 3.141592653589793. (sin, cos, tan, ..), (Math. floor,, Math. ceil,, Math. round ).
,,. JavaScript,,,,,. ,, 5,,, .
n=parseInt ( 3.14 );// 3n=parseFloat ( 3.14 )//3.14
parseInt. 3.14 raquo ;, 3 raquo ;, 3.00001 3.9999 3.
parseFloat,,. . , ParseInt ( 3a ) 3.
,,:
n=5; m=n. toString (); m=n + raquo ;; m=new String (n);
n. toString () raquo ;,,. , Alert ( + apples + ), apples.
. ,. ,, 30,:
students=new Array (); [0]= Sam raquo ;; [1]= Joe raquo ;; [2]= Sue raquo ;; [3]= Beth ;
,,,.. ,.:
students=[ Sam raquo ;, Joe raquo ;, Sue raquo ;, Beth ];
,,,. ([]),. var students=[]; , Laquo; var students=new Array (); .
,. , (0-3).. , Laquo; alert (students [2]); raquo ;. JavaScript 0, 1. students [0], - students [1], - students [99], .., JavaScript. 1.
,,,.
students=[ Sam raquo ;, Joe raquo ;, Sue raquo ;, Beth ]; suffixes=[ 1st raquo ;, ...