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

📄 ref_s-s.htm

📁 javascript函数大全HTML javascript函数大全HTML
💻 HTM
📖 第 1 页 / 共 4 页
字号:
</SELECT>
Day: <SELECT NAME="daySelection"
   onChange="updatePropertyDisplay(document.selectForm.monthSelection,this)">
   <OPTION> 1 <OPTION> 2 <OPTION> 3 <OPTION> 4 <OPTION> 5
   <OPTION> 6 <OPTION> 7 <OPTION> 8 <OPTION> 9 <OPTION> 10
   <OPTION> 11 <OPTION> 12 <OPTION> 13 <OPTION> 14 <OPTION> 15
   <OPTION> 16 <OPTION> 17 <OPTION> 18 <OPTION> 19 <OPTION> 20
   <OPTION> 21 <OPTION> 22 <OPTION> 23 <OPTION> 24 <OPTION> 25
   <OPTION> 26 <OPTION> 27 <OPTION> 28 <OPTION> 29 <OPTION> 30
   <OPTION> 31
</SELECT>
<P><B>Set the date to: </B>
<INPUT TYPE="radio" NAME="dateChoice"
   onClick="
      monthSelection.selectedIndex=0;
      daySelection.selectedIndex=0;
      updatePropertyDisplay(document.selectForm.monthSelection,document.selectForm.daySelection)">
   New Year's Day
<INPUT TYPE="radio" NAME="dateChoice"
   onClick="
      monthSelection.selectedIndex=4;
      daySelection.selectedIndex=4;
      updatePropertyDisplay(document.selectForm.monthSelection,document.selectForm.daySelection)">
   Cinco de Mayo
<INPUT TYPE="radio" NAME="dateChoice"
   onClick="
      monthSelection.selectedIndex=5;
      daySelection.selectedIndex=20;
      updatePropertyDisplay(document.selectForm.monthSelection,document.selectForm.daySelection)">
   Summer Solstice
<P><B>Property values:</B>
<BR>Date chosen: <INPUT TYPE="text" NAME="textFullDate" VALUE="" SIZE=20">
<BR>monthSelection.length<INPUT TYPE="text" NAME="textMonthLength" VALUE="" SIZE=20">
<BR>daySelection.length<INPUT TYPE="text" NAME="textDayLength" VALUE="" SIZE=20">
<BR>monthSelection.name<INPUT TYPE="text" NAME="textMonthName" VALUE="" SIZE=20">
<BR>daySelection.name<INPUT TYPE="text" NAME="textDayName" VALUE="" SIZE=20">
<BR>monthSelection.selectedIndex<INPUT TYPE="text" NAME="textMonthIndex" VALUE="" SIZE=20">
<BR>daySelection.selectedIndex<INPUT TYPE="text" NAME="textDayIndex" VALUE="" SIZE=20">
<BR>Is it Cinco de Mayo? <INPUT TYPE="text" NAME="textCinco" VALUE="" SIZE=20">
<SCRIPT>
document.selectForm.monthSelection.selectedIndex=today.getMonth()
document.selectForm.daySelection.selectedIndex=today.getDate()-1
updatePropertyDisplay(document.selectForm.monthSelection,document.selectForm.daySelection)
</SCRIPT>
</FORM>
</BODY>
</htm>
</XMP>

<P>相关 the 例子 for the <A HREF="ref_d-e.htm#defaultSelected_property" defaultSelected_property">defaultSelected</A> property.


<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#form_object" form_object">form</A> and <A HREF="ref_r-r.htm#radio_object" radio_object">radio</A> objects

<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="selected_property"><H2>selected property</H2></A>
<P>
A Boolean value specifying the current selection state of an option in a select object.

<H3>语法</H3>
<PRE><I>selectName</I>.options[<I>index</I>].selected</PRE>
<P><I>selectName</I> is either the value of the NAME attribute of a select object or an element in the <I>elements</I> array.
<BR><I>index</I> is an integer representing an option in a select object.

<H3>Property of</H3>
<P><A HREF="ref_s-s.htm#select_object" select_object">options</A> array

<H3>描述</H3>
<P>If an option in a select object is selected, the value of its selected property is true; otherwise, it is false.

<P>You can set the selected property at any time. The display of the select object updates immediately when you set the selected property.

<P>In general, the selected property is more useful than the selectedIndex property for select objects that are created with the MULTIPLE attribute. With the selected property, you can evaluate every option in the <I>options</I> array to determine multiple selections, and you can select individual options without clearing the selection of other options.

<H3>例子</H3>
<P>See the 例子 for the <A HREF="ref_d-e.htm#defaultSelected_property" defaultSelected_property">defaultSelected</A> property.

<H3>相关</H3>
<LI><A HREF="ref_d-e.htm#defaultSelected_property" defaultSelected_property">defaultSelected</A>, <A HREF="ref_h-l.htm#index_property" index_property">index</A>, <A HREF="ref_s-s.htm#selectedIndex_property" selectedIndex_property">selectedIndex</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="selectedIndex_property"><H2>selectedIndex property</H2></A>
<P>
An integer specifying the index of the selected option in a select object.

<H3>语法</H3>
<PRE>
1. <I>selectName</I>.selectedIndex
2. <I>selectName</I>.options.selectedIndex
</PRE>
<P><I>selectName</I> is either the value of the NAME attribute of a select object or an element in the <I>elements</I> array.

<H3>Property of</H3>
<LI><A HREF="ref_s-s.htm#select_object" select_object">select</A>
<LI><A HREF="ref_s-s.htm#select_object" select_object">options</A> array

<H3>描述</H3>
<P>Options in a select object are indexed in the order in which they are defined, starting with an index of 0. You can set the selectedIndex property at any time. The display of the select object updates immediately when you set the selectedIndex property. Both forms of the 语法 specify the same value.

<P>In general, the selectedIndex property is more useful for select objects that are created without the MULTIPLE attribute. If you evaluate selectedIndex when multiple options are selected, the selectedIndex property specifies the index of the first option only. Setting selectedIndex clears any other options that are selected in the select object.

<P>The selected property of the select object's <I>options</I> array is more useful for select objects that are created with the MULTIPLE attribute. With the selected property, you can evaluate every option in the <I>options</I> array to determine multiple selections, and you can select individual options without clearing the selection of other options.

<H3>例子</H3>
<P>In the following example, the <I>getSelectedIndex()</I> function returns the selected index in the <I>musicType</I> select object:
<PRE>
function getSelectedIndex() {
   return document.musicForm.musicType.selectedIndex
}
</PRE>
The previous example assumes that the select object is similar to the following:
<PRE>
&ltSELECT NAME="musicType"&gt 
   &ltOPTION SELECTED&gt R&B
   &ltOPTION&gt Jazz
   &ltOPTION&gt Blues
   &ltOPTION&gt New Age
&lt/SELECT&gt
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_d-e.htm#defaultSelected_property" defaultSelected_property">defaultSelected</A>, <A HREF="ref_h-l.htm#index_property" index_property">index</A>, <A HREF="ref_s-s.htm#selected_property" selected_property">selected</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="self_property"><H2>self property</H2></A>
<P>
The self property is a synonym for the current window or frame.

<H3>语法</H3>
<PRE>
1. self.<I>propertyName</I>
2. self.<I>methodName</I>
</PRE>
<P><I>propertyName</I> is the defaultStatus, status, length, or name property when self refers to a window object.
<BR><I>propertyName</I> is the length or name property when self refers to a frame object.
<BR><I>methodName</I> is any method associated with the window object.

<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>描述</H3>
<P>The self property refers to the current window or frame.

<P>Use the self property to disambiguate a window property from a form or form element of the same name. You can also use the self property to make your code more readable.

<P>The self property is read-only. The value of the self property is 
<PRE>     &ltobject <I>nameAttribute</I>&gt</PRE>
where <I>nameAttribute</I> is the NAME attribute if self refers to a frame, or an internal reference if self refers to a window.

<H3>例子</H3>
<P>In the following example, <TT>self.status</TT> is used to set the status property of the current window. This usage disambiguates the status property of the current window from a form or form element called "status" within the current window.
<XMP><A HREF=""
   onClick="this.href=pickRandomURL()"
   onMouseOver="self.status='Pick a random URL' ; return true">
Go!</A></XMP>

<H3>相关</H3>
<LI><A HREF="ref_t-z.htm#window_property" window_property">window</A> property
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="setDate_method"><H2>setDate method</H2></A>
<P>
Sets the day of the month for a specified date.


<H3>语法</H3>
<PRE><I>dateObjectName</I>.setDate(<I>dayValue</I>)</PRE>
<P><I>dateObjectName</I> is either the name of a date object or a property of an existing object.
<BR><I>dayValue</I> is an integer from 1 to 31 or a property of an existing object, representing the day of the month.

<H3>方法</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>

<H3>例子</H3>
<P>
The second statement below changes the day for <I>theBigDay</I> to the 24th of July from its original value.
<PRE>
theBigDay = new Date("July 27, 1962 23:30:00")
theBigDay.setDate(24)
</PRE>


<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#getDate_method" getDate_method">getDate</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="setHours_method"><H2>setHours method</H2></A>
<P>
Sets the hours for a specified date.

<H3>语法</H3>
<PRE><I>dateObjectName</I>.setHours(<I>hoursValue</I>)</PRE>
<P><I>dateObjectName</I> is either the name of a date object or a property of an existing object.
<BR><I>hoursValue</I> is an integer between 0 and 23 or a property of an existing object, representing the hour.

<H3>方法</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>

<H3>例子</H3>
<PRE>
theBigDay.setHours(7)
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#getHours_method" getHours_method">getHours</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="setMinutes_method"><H2>setMinutes method</H2></A>
<P>
Sets the minutes for a specified date.

<H3>语法</H3>
<PRE><I>dateObjectName</I>.setMinutes(<I>minutesValue</I>)</PRE>
<P><I>dateObjectName</I> is either the name of a date object or a property of an existing object.
<BR><I>minutesValue</I> is an integer between 0 and 59 or a property of an existing object, representing the minutes.

<H3>方法</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>

<H3>例子</H3>
<PRE>
theBigDay.setMinutes(45)
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#getMinutes_method" getMinutes_method">getMinutes</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="setMonth_method"><H2>setMonth method</H2></A>
<P>
Sets the month for a specified date.

<H3>语法</H3>
<PRE><I>dateObjectName</I>.setMonth(<I>monthValue</I>)</PRE>
<P><I>dateObjectName</I> is either the name of a date object or a property of an existing object.
<BR><I>monthValue</I> is an integer between 0 and 11 (representing the months January through December), or a property of an existing object.

<H3>方法</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>

<H3>例子</H3>
<PRE>
theBigDay.setMonth(6)
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#getMonth_method" getMonth_method">getMonth</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="setSeconds_method"><H2>setSeconds method</H2></A>
<P>
Sets the seconds for a specified date.

<H3>语法</H3>
<PRE><I>dateObjectName</I>.setSeconds(<I>secondsValue</I>)</PRE>
<P><I>dateObjectName</I> is either the name of a date object or a property of an existing object.
<BR><I>secondsValue</I> is an integer between 0 and 59 or a property of an existing object.

<H3>方法</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>

<H3>例子</H3>
<PRE>
theBigDay.setSeconds(30)
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#getSeconds_method" getSeconds_method">getSeconds</A> method
<!---------------------------------------------------------------------------->
<HR>
<A NAME="setTime_method"><H2>setTime method</H2></A>
<P>
Sets the value of a date object.

<H3>语法</H3>
<P><PRE><I>dateObjectName</I>.setTime(<I>timevalue</I>) </PRE>
<P><I>dateObjectName</I> is either the name of a date object or a property of an existing object.
<BR><I>timevalue</I> is an integer or a property of an existing object, representing the number of milliseconds since the epoch (1 January 1970 00:00:00).

<H3>方法</H3>
<P><A HREF="ref_d-e.htm#Date_object" Date_object">Date</A>

<H3>描述</H3>
<P>
Use the setTime method to help assign a date and time to another date object.

<H3>例子</H3>
<PRE>
theBigDay = new Date("July 1, 1999")
sameAsBigDay = new Date()
sameAsBigDay.setTime(theBigDay.getTime())
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#getTime_method" getTime_method">getTime</A> method
<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="setTimeout_method"><H2>setTimeout method</H2></A>
<P>Evaluates an expression after a specified number of milliseconds have elapsed.

⌨️ 快捷键说明

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