?? stmt.html
字號:
<HTML><HEAD> <META NAME="keywords" CONTENT="electronic commerce, ecommerce, ebusiness, e-business, e-commerce, enterprise software, net economy, Netscape, Sun Microsystems, Sun-Netscape Alliance, iPlanet, internet software"> <META NAME="description" CONTENT="The Sun-Netscape Alliance, a strategic alliance formed by America Online and Sun Microsystems, Inc., is delivering iPlanet e-commerce software and enterprise solutions that enable companies to compete successfully in the Net Economy"> <META HTTP-EQUIV="Content-Type" content="text/html; charset=ISO-8859-1"> <META NAME="TEMPLATEBASE" CONTENT="Authored in FrameMaker. Converted to HTML in WebWorks Publisher 2000. manual wdt 1.5"> <META NAME="LASTUPDATED" CONTENT="09/28/00 13:16:14"> <TITLE> Core JavaScript Reference 1.5: 3 Statements</TITLE></HEAD><BODY TEXT="#000000" LINK="#666699" VLINK="#666699" ALINK="#333366" BGCOLOR="#FFFFFF"><MAINCONTENT><NAVIGATIONCONTENT> <TABLE WIDTH="100%" BORDER="0" CELLSPACING="4"> <TR> <TD VALIGN="TOP"> <b><a href="partlang.html"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Previous</a></FONT> </b><a href="contents.html"><b><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Contents</a></FONT></b> <a href="ix.html"><b><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Index</a></FONT></b> <a href="comment.html"><b><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#993300">Next</a></FONT></b> </TD> </TR> <TR> <TD VALIGN="TOP" ALIGN="RIGHT" BGCOLOR="#CCCCCC"> <FONT FACE="Arial, Helvetica, sans-serif" COLOR="#000000" SIZE="2"><B> Core JavaScript Reference 1.5</B></FONT> </TD> </TR> <TR> </TABLE> <BR></NAVIGATIONCONTENT><BOOKCONTENT> <blockquote><BR><BR> <A NAME="1005816"> </A><A NAME=""> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4" COLOR="#666666"><B><zchapnumber>Chapter 3 </zchapnumber> </B></FONT><A NAME="1003191"> </A><A NAME="Statements"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4" COLOR="#000000"><B><zchaptitle>Chapter 3 Statements</zchaptitle></B></FONT><BR><BR><BR><A NAME="1007251"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>This chapter describes all JavaScript statements. JavaScript statements consist of keywords used with the appropriate syntax. A single statement may span multiple lines. Multiple statements may occur on a single line if each statement is separated by a semicolon.</zparagraph></FONT><P><A NAME="1004756"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Syntax conventions: All keywords in syntax statements are in bold. Words in italics represent user-defined names or statements. Any portions enclosed in square brackets, [ ], are optional. {statements} indicates a block of statements, which can consist of zero or more statements delimited by a curly braces { }.</zparagraph></FONT><P><A NAME="1042702"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The following table lists statements available in JavaScript.</zparagraph></FONT><P><P><A NAME="1081296"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B><A NAME="1081167"> </A><A NAME="JavaScript statements. "> </A><ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablecaption>Table 3.1    JavaScript statements. </ztablecaption></B></FONT></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><A NAME="1081174"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1081298" >break</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081176"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Terminates the current while or for loop and transfers program control to the statement following the terminated loop.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081181"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1077887" >const</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081183"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Declares a global constant, optionally initializing it to a value.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081188"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1078923" >continue</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081190"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Terminates execution of the block of statements in a while or for loop, and continues execution of the loop with the next iteration.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081195"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1037353" >do...while</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081197"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Executes the specified statements until the test condition evaluates to false. Statements execute at least once.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081202"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1016648" >export</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081204"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Allows a signed script to provide properties, functions, and objects to other signed or unsigned scripts.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081209"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004804" >for</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081211"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a block of statements executed in the loop.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081216"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004815" >for...in</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081218"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Iterates a specified variable over all the properties of an object. For each distinct property, JavaScript executes the specified statements.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081223"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004825" >function</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081225"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Declares a function with the specified parameters. Acceptable parameters include strings, numbers, and objects.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081230"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004833" >if...else</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081232"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Executes a set of statements if a specified condition is true. If the condition is false, another set of statements can be executed.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081237"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1082618" >import</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081239"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Allows a script to import properties, functions, and objects from a signed script that has exported the information.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081244"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1018088" >label</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081246"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Provides an identifier that can be used with break or continue to indicate where the program should continue execution.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081251"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004871" >return</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081253"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Specifies the value to be returned by a function.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081258"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1018610" >switch</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081260"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Allows a program to evaluate an expression and attempt to match the expression's value to a case label.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081265"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1052196" >throw</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081267"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Throws a user-defined exception.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081272"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1051663" >try...catch</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081274"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Marks a block of statements to try, and specifies a response should an exception be thrown.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081279"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1066604" >var</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081281"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Declares a variable, optionally initializing it to a value.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081286"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004896" >while</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081288"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Creates a loop that evaluates an expression, and if it is true, executes a block of statements. The loop then repeats, as long as the specified condition is true.</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><A NAME="1081293"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="stmt.html#1004910" >with</A></zcodeline></FONT><P> </TD> <TD VALIGN=TOP><P><A NAME="1081295"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Establishes the default object for a set of statements.</ztabletext></FONT> </TD> </TR></TABLE><P></FONT><P><BR><BR><A NAME="1081298"> </A><A NAME="break"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><zhead1>break</zhead1><HR SIZE="2" NOSHADE></FONT><BR><A NAME="1081299"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Use the break statement to terminate a loop, <FONT FACE="courier, couriernew, monospaced size">switch</FONT>, or label statement.</zparagraph></FONT><P><A NAME="1050041"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Terminates the current loop, <FONT FACE="courier, couriernew, monospaced size">switch</FONT>, or label statement and transfers program control to the statement following the terminated loop. <BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0"> <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR> <TR> <TD VALIGN=TOP><P><A NAME="1050044"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1050046"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.0, NES 2.0</ztabletext></FONT> </TD> </TR> <TR> <TD VALIGN=TOP><P><A NAME="1050093"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>ECMA version</I></ztabletext></FONT> </TD> <TD VALIGN=TOP><P><A NAME="1050095"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA-262 (for the unlabeled version)<br>ECMA-262, Edition 3 (for the labeled version)</ztabletext></FONT> </TD> </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1073781"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1073782"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>break [<I>label</I>]</zcodeline></FONT><P><BR><A NAME="1014318"> </A><A NAME="Parameter"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Parameter</zrefheader>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -