⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ref_m-q.htm

📁 javascript函数大全HTML javascript函数大全HTML
💻 HTM
📖 第 1 页 / 共 4 页
字号:
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#isNaN_method" isNaN_method">isNaN</A>, <A HREF="ref_m-q.htm#parseFloat_method" parseFloat_method">parseFloat</A> functions

<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="password_object"><H2>password object</H2></A>
<P>A text field on an htm form that conceals its value by displaying asterisks (*). When the user enters text into the field, asterisks (*) hide anything entered from view.


<H3>语法</H3>
<P>To define a password object, use standard htm 语法:
<PRE>
&LTINPUT
   TYPE="password"
   NAME="<I>passwordName</I>"
   [VALUE="<I>textValue</I>"]
   SIZE=<I>integer</I>&GT
</PRE>
<I>NAME="passwordName"</I> specifies the name of the password object. You can access this value using the name property.
<BR><I>VALUE="textValue"</I> specifies the initial value of the password object. You can access this value using the defaultValue property.
<BR><I>SIZE=integer</I> specifies the number of characters the password object can accommodate without scrolling.

<P>To use a password object's properties and methods:
<PRE>
1. <I>passwordName</I>.<I>propertyName</I>
2. <I>passwordName</I>.<I>methodName</I>(<I>parameters</I>)
3. <I>formName</I>.elements[<I>index</I>].<I>propertyName</I>
4. <I>formName</I>.elements[<I>index</I>].<I>methodName</I>(<I>parameters</I>)
</PRE>
<I>passwordName</I> is the value of the NAME attribute of a password object.
<BR><I>formName</I> is either the value of the NAME attribute of a form object or an element in the <I>forms</I> array.
<BR><I>index</I> is an integer representing a password object on a form.
<BR><I>propertyName</I> is one of the properties listed below.
<BR><I>methodName</I> is one of the methods listed below.


<H3>Property of</H3>
<LI><A HREF="ref_f-g.htm#form_object" form_object">form</A>


<H3>Description</H3>
<P>A password object on a form looks as follows:
<FORM>
<P><B>Enter your password:</B> <INPUT TYPE="password" VALUE="baylaurel" SIZE=25>
</FORM>
<P>A password object is a form element and must be defined within a &LTFORM&GT tag.


<H3>Properties</H3>
<LI><A HREF="ref_d-e.htm#defaultValue_property" defaultValue_property">defaultValue</A> reflects the VALUE attribute
<LI><A HREF="ref_m-q.htm#name_property" name_property">name</A> reflects the NAME attribute
<LI><A HREF="ref_t-z.htm#value_property" value_property">value</A> reflects the current value of the password object's field


<H3>Methods</H3>
<LI><A HREF="ref_f-g.htm#focus_method" focus_method">focus</A>
<LI><A HREF="ref_a-c.htm#blur_method" blur_method">blur</A>
<LI><A HREF="ref_s-s.htm#select_method" select_method">select</A>


<H3>Event handlers</H3>
<LI>None.


<H3>例子</H3>
<P>
<XMP>
<B>Password:</B> <INPUT TYPE="password" NAME="password" VALUE="" SIZE=25>
</XMP>


<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#form_object" form_object">form</A> and <A HREF="ref_t-z.htm#text_object" text_object">text</A> objects


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="pathname_property"><H2>pathname property</H2></A>
<P>
A string specifying the url-path portion of the URL.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].pathname
2. location.pathname
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>Description</H3>
<P>The pathname property specifies a portion of the URL. The pathname supplies the details of how the specified resource can be accessed.

<P>You can set the pathname property at any time, although it is safer to set the href property to change a location. If the pathname that you specify cannot be found in the current location, you will get an error.

<P>See Section 3.1 of <A HREF="tppmsgs/msgs0.htm#12" tppabs="http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.htm" TARGET="_top">RFC 1738</A> for complete information about the pathname.


<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_h-l.htm#href_property" href_property">href</A> property.

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#hash_property" hash_property">hash</A>, <A HREF="ref_h-l.htm#host_property" host_property">host</A>, <A HREF="ref_h-l.htm#hostname_property" hostname_property">hostname</A>, <A HREF="ref_h-l.htm#href_property" href_property">href</A>, <A HREF="ref_m-q.htm#port_property" port_property">port</A>, <A HREF="ref_m-q.htm#protocol_property" protocol_property">protocol</A>, <A HREF="ref_s-s.htm#search_property" search_property">search</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="PI_property"><H2>PI property</H2></A>
<P>
The ratio of the circumference of a circle to its diameter, approximately 3.14159.

<H3>语法</H3>
<PRE>Math.PI</PRE>

<H3>Property of</H3>
<P><A HREF="ref_m-q.htm#Math_object" Math_object">Math</A>

<H3>Description</H3>
<P>Because PI is a constant, it is a read-only property of Math.

<H3>例子</H3>
<P>The following example displays the value of pi:
<PRE>document.write("The value of pi is " + Math.PI)</PRE>

<H3>相关</H3>
<LI><A HREF="ref_d-e.htm#E_property" E_property">E</A>, <A HREF="ref_h-l.htm#LN2_property" LN2_property">LN2</A>, <A HREF="ref_h-l.htm#LN10_property" LN10_property">LN10</A>, <A HREF="ref_h-l.htm#LOG2E_property" LOG2E_property">LOG2E</A>, <A HREF="ref_h-l.htm#LOG10E_property" LOG10E_property">LOG10E</A>, <A HREF="ref_s-s.htm#SQRT1_2_property" SQRT1_2_property">SQRT1_2</A>, <A HREF="ref_s-s.htm#SQRT2_property" SQRT2_property">SQRT2</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="port_property"><H2>port property</H2></A>
<P>
A string specifying the communications port that the server uses for communications.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].port
2. location.port
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>Description</H3>
<P>The port property specifies a portion of the URL. The port property is a substring of the host property. The host property is the concatenation of the hostname and port properties, separated by a colon. When the port property is not defined, the host property is the same as the hostname property.

<P>You can set the port property at any time, although it is safer to set the href property to change a location. If the port that you specify cannot be found in the current location, you will get an error. If the port property is not specified, it defaults to 80 on the server.

<P>See Section 3.1 of <A HREF="tppmsgs/msgs0.htm#12" tppabs="http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.htm" TARGET="_top">RFC 1738</A> for complete information about the port.

<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_h-l.htm#href_property" href_property">href</A> property.

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#hash_property" hash_property">hash</A>, <A HREF="ref_h-l.htm#host_property" host_property">host</A>, <A HREF="ref_h-l.htm#hostname_property" hostname_property">hostname</A>, <A HREF="ref_h-l.htm#href_property" href_property">href</A>, <A HREF="ref_m-q.htm#pathname_property" pathname_property">pathname</A>, <A HREF="ref_m-q.htm#protocol_property" protocol_property">protocol</A>, <A HREF="ref_s-s.htm#search_property" search_property">search</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="pow_method"><H2>pow method</H2></A>
<P>
Returns <I>base</I> to the <I>exponent</I> power, that is, <I>base</I><sup><I>exponent</I></sup>.

<H3>语法</H3>
<PRE>Math.pow(<I>base, exponent</I>)</PRE>
<I>base</I> is any numeric expression or a property of an existing object.
<BR><I>exponent</I> is any numeric expression or a property of an existing object.
If the result would include an imaginary number (for example pow(-1, 0.5)), then the value returned is
always zero.

<H3>Method of</H3>
<P><A HREF="ref_m-q.htm#Math_object" Math_object">Math</A>

<H3>例子</H3>
<PRE>
//Displays the value 49
document.write("7 to the power of 2 is " + Math.pow(7,2))

//Displays the value 1024
document.write("&ltP&gt2 to the power of 10 is " + Math.pow(2,10))
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_d-e.htm#exp_method" exp_method">exp</A>, <A HREF="ref_h-l.htm#log_method" log_method">log</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="prompt_method"><H2>prompt method</H2></A>
<P>
Displays a Prompt dialog box with a message and an input field.

<H3>语法</H3>
<PRE>prompt(<I>message</I>, [<i>inputDefault</i>])</PRE>
<I>message</I> is any string or a property of an existing object; the string is displayed as the message.
<BR><I>inputDefault</I> is a string, integer, or property of an existing object that represents the default value of the input field.


<H3>Method of</H3>
<P><A HREF="ref_t-z.htm#window_object" window_object">window</A>

<H3>Description</H3>
<P>Use the prompt method to display a dialog box that receives user input. If you do not specify an initial value for <I>inputDefault</I>, the dialog box displays the value &ltundefined&gt.

<P>Although prompt is a method of the window object, you do not need to specify a <I>windowReference</I> when you call it. For example, <TT><I>windowReference</I>.prompt()</TT> is unnecessary.

<H3>例子</H3>
<PRE>
prompt("Enter the number of cookies you want to order:", 12)
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#alert_method" alert_method">alert</A>, <A HREF="ref_a-c.htm#confirm_method" confirm_method">confirm</A> methods
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="protocol_property"><H2>protocol property</H2></A>
<P>
A string specifying the beginning of the URL, up to and including the first colon.

<H3>语法</H3>
<PRE>
1. links[<I>index</I>].protocol
2. location.protocol
</PRE>
<P><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_h-l.htm#link_object" link_object">link</A>, <A HREF="ref_h-l.htm#location_object" location_object">location</A>

<H3>Description</H3>
<P>The protocol property specifies a portion of the URL. The protocol indicates the access method of the URL. For example, a protocol of "http:" specifies Hypertext Transfer Protocol, and a protocol of "javascript:" specifies JavaScript code.

<P>You can set the protocol property at any time, although it is safer to set the href property to change a location. If the protocol that you specify cannot be found in the current location, you will get an error.

<P>The protocol property represents the scheme name of the URL. See Section 2.1 of <A HREF="tppmsgs/msgs0.htm#12" tppabs="http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.htm" TARGET="_top">RFC 1738</A> for complete information about the protocol.


<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_h-l.htm#href_property" href_property">href</A> property.

<H3>相关</H3>
<LI><A HREF="ref_h-l.htm#hash_property" hash_property">hash</A>, <A HREF="ref_h-l.htm#host_property" host_property">host</A>, <A HREF="ref_h-l.htm#hostname_property" hostname_property">hostname</A>, <A HREF="ref_h-l.htm#href_property" href_property">href</A>, <A HREF="ref_m-q.htm#pathname_property" pathname_property">pathname</A>, <A HREF="ref_m-q.htm#port_property" port_property">port</A>, <A HREF="ref_s-s.htm#search_property" search_property">search</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>

<SCRIPT>
document.write("<FONT SIZE=-2>Last modified " + document.lastModified)
</SCRIPT>
<P>
</BODY>
<htm>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -