📄 ref_m-q.htm
字号:
function probePlugIn(mimeType) {
var havePlugIn = false
var tiny = window.open("", "teensy", "width=1,height=1")
if (tiny != null) {
if (tiny.document.open(mimeType) != null)
havePlugIn = true
tiny.close()
}
return havePlugIn
}
var haveShockwavePlugIn = probePlugIn("application/x-director")
</PRE>
<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#clear_method" clear_method">clear</A>, <A HREF="ref_a-c.htm#close_document_method" close_document_method">close</A>, <A HREF="ref_t-z.htm#write_method" write_method">write</A>, <A HREF="ref_t-z.htm#writeln_method" writeln_method">writeln</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="open_window_method"><H2>open method (window object)</H2></A>
<P>
Opens a new web browser window.
<H3>语法</H3>
<PRE>
[<I>windowVar</I> = ][window].open("<I>URL</I>", "<I>windowName</I>", ["<I>windowFeatures</I>"])
</PRE>
<P><I>windowVar</I> is the name of a new window. Use this variable when referring to a window's properties, methods, and containership.
<BR><I>URL</I> specifies the URL to open in the new window. See the <A HREF="ref_h-l.htm#location_object" location_object">location</A> object for a description of the URL components.
<BR><I>windowName</I> is the window name to use in the TARGET attribute of a <FORM> or <A> tag. <I>windowName</I> can contain only alphanumeric or underscore (_) characters.
<BR><I>windowFeatures</I> is a comma-separated list of any of the following options and values:
<PRE>
toolbar[=yes|no]|[=1|0]
location[=yes|no]|[=1|0]
directories[=yes|no]|[=1|0]
status[=yes|no]|[=1|0]
menubar[=yes|no]|[=1|0]
scrollbars[=yes|no]|[=1|0]
resizable[=yes|no]|[=1|0]
width=<I>pixels</I>
height=<I>pixels</I>
</PRE>
<P>You may use any subset of these options. Separate options with a comma. Do not put spaces between the options.
<P><I>pixels</I> is a positive integer specifying the dimension in pixels.
<H3>Method of</H3>
<P><A HREF="ref_t-z.htm#window_object" window_object">window</A>
<H3>Description</H3>
<P>The open method opens a new web browser window on the client, similar to choosing New Web Browser from the File menu of the Navigator. The <I>URL</I> argument specifies the URL contained by the new window. If <I>URL</I> is an empty string, a new, empty window is created.
<P>In event handlers, you must specify window.open() instead of simply using open(). Due to the scoping of static objects in JavaScript, a call to open() without specifying an object name is equivalent to document.open().
<P><I>windowFeatures</I> is an optional, comma-separated list of options for the new window. The boolean <I>windowFeatures</I> options are set to true if they are specified without values, or as <TT>yes</TT> or <TT>1</TT>. For example, <TT>open("", "messageWindow", "toolbar")</TT> and <TT>open("", "messageWindow", "toolbar=1")</TT> both set the toolbar option to true. If <I>windowName</I> does not specify an existing window and you do not specify <I>windowFeatures</I>, all boolean <I>windowFeatures</I> are true by default. If you specify any item in <I>windowFeatures</I>, all other Boolean <I>windowFeatures</I> are false unless you explicitly specify them.
<P>Following is a description of the <I>windowFeatures</I>:
<LI><I>toolbar</I> creates the standard Navigator toolbar, with buttons such as "Back" and "Forward", if true
<LI><I>location</I> creates a Location entry field, if true
<LI><I>directories</I> creates the standard Navigator directory buttons, such as "What's New" and "What's Cool", if true
<LI><I>status</I> creates the status bar at the bottom of the window, if true
<LI><I>menubar</I> creates the menu at the top of the window, if true
<LI><I>scrollbars</I> creates horizontal and vertical scrollbars when the document grows larger than the window dimensions, if true
<LI><I>resizable</I> allows a user to resize the window, if true
<LI><I>width</I> specifies the width of the window in pixels
<LI><I>height</I> specifies the height of the window in pixels
<H3>例子</H3>
<P>In the following example, the windowOpener function opens a window and uses write methods to display a message:
<PRE>function windowOpener() {
msgWindow=window.open("","displayWindow","menubar=yes")
msgWindow.document.write
("<HEAD><TITLE>Message window</TITLE></HEAD>")
msgWindow.document.write
("<CENTER><BIG><B>Hello, world!</B></BIG></CENTER>")
}
</PRE>
<P>
The following is an onClick event handler that opens a new client window displaying the content specified in the file <I>sesame.htm</I>. The window opens with the specified option settings; all other options are false because they are not specified.
<xmp>
<FORM NAME="myform">
<INPUT TYPE="button" NAME="Button1" VALUE="Open Sesame!"
onClick="window.open
('sesame.htm', 'newWin', 'scrollbars=yes,status=yes,width=300,height=300')">
</FORM>
</xmp>
<P>
Notice the use of single quotes (') inside the onClick event handler.
<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#close_window_method" close_window_method">close</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="options_property"><H2>options property</H2></A>
<P>An array corresponding to options in a select object (<OPTION> tags) in source order. See <A HREF="ref_s-s.htm#select_object" select_object">select</A> object.
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="parent_property"><H2>parent property</H2></A>
<P>
The parent property is a synonym for a window or frame whose frameset contains the current frame.
<H3>语法</H3>
<PRE>
1. parent.<I>propertyName</I>
2. parent.<I>methodName</I>
3. parent.<I>frameName</I>
4. parent.frames[<I>index</I>]
</PRE>
<P><I>propertyName</I> is the defaultStatus, status, length, name, or parent property when the calling parent refers to a window object.
<BR><I>propertyName</I> is the length, name, or parent property when the calling parent refers to a frame object.
<BR><I>methodName</I> is any method associated with the window object.
<BR><I>frameName</I> and frames[<I>index</I>] are ways to refer to frames.
<H3>Property of</H3>
<P><A HREF="ref_f-g.htm#frame_object" frame_object">frame</A>, <A HREF="ref_t-z.htm#window_object" window_object">window</A>
<H3>Description</H3>
<P>The parent property refers to the <FRAMESET> window of a frame. Child frames within a frameset refer to sibling frames by using "parent" in place of the window name as follows: <TT>parent.<I>frameName</I></TT> or <TT>parent.frames[<I>index</I>]</TT>. For example, if the fourth frame in a set has NAME="homeFrame", sibling frames can refer to that frame using <TT>parent.homeFrame</TT> or <TT>parent.frames[3]</TT>.
<P>You can use <TT>parent.parent</TT> to refer to the "grandparent" frame or window when a <FRAMESET> tag is nested within a child frame.
<P>The parent property is read-only. The value of the parent property is
<PRE> <object <I>nameAttribute</I>></PRE>
where <I>nameAttribute</I> is the NAME attribute if the parent is a frame, or an internal reference if the parent is a window.
<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_f-g.htm#frame_object" frame_object">frame</A> object.
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="parse_method"><H2>parse method</H2></A>
<P>
Returns the number of milliseconds in a date string since January 1, 1970 00:00:00, local time.
<H3>语法</H3>
<PRE>Date.parse(<I>dateString</I>)</PRE>
<I>dateString</I> is a string representing a date or a property of an existing object.
<H3>Method of</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>
<H3>Description</H3>
<P>
The parse method takes a date string (such as "Dec 25, 1995"), and returns the number of milliseconds since January 1, 1970 00:00:00 (local time). This function is useful for setting date values based on string values, for example in conjunction with the setTime method and the Date object.
<P>
Given a string representing a time, parse returns the time value. It accepts the IETF standard date 语法: "Mon, 25 Dec 1995 13:30:00 GMT". It understands the continental US time zone abbreviations, but for general use, use a time zone offset, for example "Mon, 25 Dec 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If you do not specify a time zone, the local time zone is assumed. GMT and UTC are considered equivalent.
<P>
Because the parse function is a static method of Date, you always use it as <code>Date.parse()</code>, rather than as a method of a date object you created.
<H3>例子</H3>
<P>
If <I>IPOdate</I> is an existing date object, then
<PRE>
IPOdate.setTime(Date.parse("Aug 9, 1995"))
</PRE>
<H3>相关</H3>
<LI><A HREF="ref_t-z.htm#UTC_method" UTC_method">UTC</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="parseFloat_method"><H2>parseFloat function</H2></A>
<P>
Parses a string argument and returns a floating point number.
<H3>语法</H3>
<PRE>parseFloat(<I>string</I>)</PRE>
<P><I>string</I> is a string that represents the value you want to parse.
<H3>Description</H3>
<P>The parseFloat function is a built-in JavaScript function. It is not a method associated with any object, but is part of the language itself.
<P>parseFloat parses its argument, a string, and returns a floating point number. If it encounters a character other than a sign ( + or -), numeral (0-9), a decimal point, or an exponent, then it returns the value up to that point and ignores that character and all succeeding characters.
<P>If the first character cannot be converted to a number, parseFloat returns one of the following values:
<LI>0 on Windows platforms.
<LI>"NaN" on any other platform, indicating that the value is not a number.
<P>For arithmetic purposes, the "NaN" value is not a number in any radix. You can call the isNaN function to determine if the result of parseFloat is "NaN". If "NaN" is passed on to arithmetic operations, the operation results will also be "NaN".
<H3>例子</H3>
<P>
The following 例子 all return 3.14:
<PRE>
parseFloat("3.14")
parseFloat("314e-2")
parseFloat("0.0314E+2")
var x = "3.14"
parseFloat(x)
</PRE>
<P>
The following example returns "NaN" or 0:
<PRE>
parseFloat("FF2")
</PRE>
<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#isNaN_method" isNaN_method">isNaN</A>, <A HREF="ref_m-q.htm#parseInt_method" parseInt_method">parseInt</A> functions
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="parseInt_method"><H2>parseInt function</H2></A>
<P>
Parses a string argument and returns an integer of the specified radix or base.
<H3>语法</H3>
<PRE>parseInt(<I>string</I> [,<I>radix</I>])</PRE>
<P><I>string</I> is a string that represents the value you want to parse.
<BR><I>radix</I> is an integer that represents the radix of the return value.
<H3>Description</H3>
<P>The parseInt function is a built-in JavaScript function. It is not a method associated with any object, but is part of the language itself.
<P>The parseInt function parses its first argument, a string, and attempts to return an integer of the specified radix (base). For example, a radix of 10 indicates to convert to a decimal number, 8 octal, 16 hexadecimal, and so on. For radixes above 10, the letters of the alphabet indicate numerals greater than 9. For example, for hexadecimal numbers (base 16), A through F are used.
<P>If parseInt encounters a character that is not a numeral in the specified radix, it ignores it and all succeeding characters and returns the integer value parsed up to that point. ParseInt truncates numbers to integer values.
<P>If the radix is not specified or is specified as 0, JavaScript assumes the following:
<LI>If the input <I>string</I> begins with "0x", the radix is 16 (hexadecimal).
<LI>If the input <I>string</I> begins with "0", the radix is 8 (octal).
<LI>If the input <I>string</I> begins with any other value, the radix is 10 (decimal).
<P>If the first character cannot be converted to a number, parseFloat returns one of the following values:
<LI>0 on Windows platforms.
<LI>"NaN" on any other platform, indicating that the value is not a number.
<P>For arithmetic purposes, the "NaN" value is not a number in any radix. You can call the isNaN function to determine if the result of parseInt is "NaN". If "NaN" is passed on to arithmetic operations, the operation results will also be "NaN".
<H3>例子</H3>
<P>The following 例子 all return 15:
<PRE>
parseInt("F", 16)
parseInt("17", 8)
parseInt("15", 10)
parseInt(15.99, 10)
parseInt("FXX123", 16)
parseInt("1111", 2)
parseInt("15*3", 10)
</PRE>
<P>The following 例子 all return "NaN" or 0:
<PRE>
parseInt("Hello", 8)
parseInt("0x7", 10)
parseInt("FFF", 10)
</PRE>
<P>Even though the radix is specified differently, the following 例子 all return 17 because the input <I>string</I> begins with "0x".
<PRE>
parseInt("0x11", 16)
parseInt("0x11", 0)
parseInt("0x11")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -