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

📄 ref_t-z.htm

📁 javascript函数大全HTML javascript函数大全HTML
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<H3>例子</H3>
<P>The following example returns "&"
<PRE>
unescape("%26")
</PRE>

<P>The following example returns "!#"
<PRE>
unescape("%21%23")
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_d-e.htm#escape_method" escape_method">escape</A> function

<!----------------------------------------------------------------->
<HR>
<A NAME="userAgent_property"><H2>userAgent property</H2></A>
<P>
A string representing the value of the user-agent header sent in the HTTP protocol from client to server.

<H3>语法</H3>
<PRE>navigator.userAgent</PRE>

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

<H3>描述</H3>
<P>Servers use the value sent in the user-agent header to identify the client.

<P>userAgent is a read-only property.


<H3>例子</H3>
<P>The following example displays userAgent information for the Navigator:
<PRE>document.write("The value of navigator.userAgent is " +
   navigator.userAgent)</PRE>
<P>For Navigator 2.0, this displays the following:
<PRE>The value of navigator.userAgent is Mozilla/2.0 (Win16; I)</PRE>

<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#appName_property" appName_property">appName</A>, <A HREF="ref_a-c.htm#appVersion_property" appVersion_property">appVersion</A>, <A HREF="ref_a-c.htm#appCodeName_property" appCodeName_property">appCodeName</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="UTC_method"><H2>UTC method</H2></A>
<P>
Returns the number of milliseconds in a date object since January 1, 1970 00:00:00, Universal Coordinated Time (GMT).

<H3>语法</H3>
<PRE>Date.UTC(<I>year, month, day [, hrs] [, min] [, sec]</I>)</PRE>
<P><I>year</I> is a year after 1900.
<BR><I>month</I> is a month between 0-11.
<BR><I>date</I> is a day of the month between 1-31.
<BR><I>hrs</I> is hours between 0-23.
<BR><I>min</I> is minutes between 0-59.
<BR><I>sec</I> is seconds between 0-59.

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

<H3>描述</H3>
<P>
UTC takes comma-delimited date parameters and returns the number of milliseconds since January 1, 1970 00:00:00, Universal Coordinated Time (GMT).

<P>
Because UTC is a static 用法 Date, you always use it as <TT>Date.UTC()</TT>, rather than as a 用法 a date object you created.

<H3>例子</H3>
<P>
The following statement creates a date object using GMT instead of local time:

<PRE>
gmtDate = new Date(Date.UTC(96, 11, 1, 0, 0, 0))
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_m-q.htm#parse_method" parse_method">parse</A> method

<!------------------------------------------------------------------------------------------------>
<HR>
<A NAME="value_property"><H2>value property</H2></A>
<P>
A string that is related to the VALUE attribute of its object.

<H3>语法</H3>
<PRE>
1. <I>objectName</I>.value
2. <I>radioName</I>[<I>index</I>].value
3. <I>selectName</I>.options.[<I>index</I>].value
</PRE>
<P><I>objectName</I> is either the value of the NAME attribute of a hidden, password, text, textarea, button, reset, submit or checkbox object or an element in the <I>elements</I> array.
<BR><I>radioName</I> is the value of the NAME attribute of a radio object.
<BR><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 a radio button in a radio object or an option in a select object.

<H3>Property of</H3>
<LI><A HREF="ref_a-c.htm#button_object" button_object">button</A>, <A HREF="ref_a-c.htm#checkbox_object" checkbox_object">checkbox</A>, <A HREF="ref_h-l.htm#hidden_object" hidden_object">hidden</A>, <A HREF="ref_m-q.htm#password_object" password_object">password</A>, <A HREF="ref_r-r.htm#radio_object" radio_object">radio</A>, <A HREF="ref_r-r.htm#reset_object" reset_object">reset</A>, <A HREF="ref_s-s.htm#submit_object" submit_object">submit</A>, <A HREF="ref_t-z.htm#text_object" text_object">text</A>, <A HREF="ref_t-z.htm#textarea_object" textarea_object">textarea</A> objects <LI><A HREF="ref_s-s.htm#select_object" select_object">options</A> array

<H3>描述</H3>
<P>The value property differs for every object.

<H4>hidden, text, and textarea objects</H4>
The value property is a string that initially reflects the VALUE attribute. This string is displayed in the text and textarea fields. The value of this property changes when a user or a program modifies the field.

<P>You can set the value property at any time. The display of the text and textarea objects updates immediately when you set the value property.

<H4>password object</H4>
<P>The value property is a string that initially reflects the VALUE attribute. This string is represented by asterisks in the password object field. The value of this property changes when a user or a program modifies the field, but the value is always displayed as asterisks.

<P>If you programatically set the value property and then evaluate it, JavaScript returns the current value. If a user interactively modifies the value in the password field, you cannot evaluate it accurately for security reasons.

<H4>button, reset, and submit objects</H4>
<P>When a VALUE attribute is specified in htm, the value property is a string that reflects it. This string is displayed on the face of the button.

<P>When a VALUE attribute is not specified in htm, the value property differs for each object:
<LI>For button, it is an empty string
<LI>For reset, it is the string "Reset"
<LI>For submit, it is the string "Submit Query"

<P>These strings are displayed on the faces of the buttons.

<P>value is a read-only property.

<P>Do not confuse the value property with the name property. The name property is not displayed onscreen; it is used to reference the objects programatically.

<H4>options array</H4>
<P>The value property is a string that initially reflects the VALUE attribute. The value of this property can change when a program modifies it. The value property is not displayed onscreen, but is returned to the server if the option is selected.

<P>You can set the value property at any time.

<P>Do not confuse the value property with the selection state of the select object or the text that is displayed as an option. The selected and selectedIndex properties determine which options are selected, and the defaultSelected property determines the default selection state. The text that is displayed in each option is specified by its text property.

<H4>checkbox and radio objects</H4>
<P>When a VALUE attribute is specified in htm, the value property is a string that reflects it. When a VALUE attribute is not specified in htm, the value property is a string that evaluates to "on". The value property is not displayed onscreen, but is returned to the server if the radio button or checkbox is selected.

<P>You can set the value property at any time.

<P>Do not confuse the value property with the selection state of the object or the text that is displayed next to each checkbox and radio button. The checked property determines the selection state of the object, and the defaultChecked property determines the default selection state. The text that is displayed is specified following the &ltINPUT TYPE="checkbox"&gt or the &ltINPUT TYPE="radio"&gt tag.

<H3>例子</H3>
<P>The following function evaluates the value property of a group of buttons and displays it in the <I>msgWindow</I> window:
<PRE>
function valueGetter() {
   var msgWindow=window.open("")
   msgWindow.document.write("submitButton.value is " +
      document.valueTest.submitButton.value + "&ltBR&gt")
   msgWindow.document.write("resetButton.value is " +
      document.valueTest.resetButton.value + "&ltBR&gt")
   msgWindow.document.write("helpButton.value is " +
      document.valueTest.helpButton.value + "&ltBR&gt")
   msgWindow.document.close()
}
</PRE>

<P>This example displays the following values:
<PRE>
Query Submit
Reset
Help
</PRE>

<P>The previous example assumes the buttons have been defined as follows
<PRE>
&ltINPUT TYPE="submit" NAME="submitButton"&gt
&ltINPUT TYPE="reset" NAME="resetButton"&gt
&ltINPUT TYPE="button" NAME="helpButton" VALUE="Help"&gt
</PRE>

<P>The following function evaluates the value property of a group of radio buttons and displays it in the <I>msgWindow</I> window:
<PRE>
function valueGetter() {
   var msgWindow=window.open("")
   for (var i = 0; i < document.valueTest.radioObj.length; i++) {
       msgWindow.document.write
          ("The value of radioObj[" + i + "] is " +
          document.valueTest.radioObj[i].value +"&ltBR&gt")
   }
   msgWindow.document.close()
}
</PRE>

<P>This example displays the following values:
<PRE>
on
on
on
on
</PRE>

<P>The previous example assumes the buttons have been defined as follows
<PRE>
&ltBR&gt&ltINPUT TYPE="radio" NAME="radioObj"&gtR&B
&ltBR&gt&ltINPUT TYPE="radio" NAME="radioObj" CHECKED&gtSoul
&ltBR&gt&ltINPUT TYPE="radio" NAME="radioObj"&gtRock and Roll
&ltBR&gt&ltINPUT TYPE="radio" NAME="radioObj"&gtBlues
</PRE>

<H3>相关</H3>
<P>For hidden, password, text, and textarea:
<LI><A HREF="ref_d-e.htm#defaultValue_property" defaultValue_property">defaultValue</A> property

<P>For button, reset, and submit:
<LI><A HREF="ref_m-q.htm#name_property" name_property">name</A> property

<P>For options array:
<LI><A HREF="ref_d-e.htm#defaultSelected_property" defaultSelected_property">defaultSelected</A>, <A HREF="ref_s-s.htm#selected_property" selected_property">selected</A>, <A HREF="ref_s-s.htm#selectedIndex_property" selectedIndex_property">selectedIndex</A>, <A HREF="ref_t-z.htm#text_property" text_property">text</A> properties

<P>For checkbox and radio:
<LI><A HREF="ref_a-c.htm#checked_property" checked_property">checked</A>, <A HREF="ref_d-e.htm#defaultChecked_property" defaultChecked_property">defaultChecked</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="vlinkColor_property"><H2>vlinkColor property</H2></A>
<P>
A string specifying the color of visited links.

<H3>语法</H3>
<PRE>document.vlinkColor</PRE>

<H3>Property of</H3>
<P><A HREF="ref_d-e.htm#document_object" document_object">document</A>

<H3>描述</H3>
<P>The vlinkColor property is expressed as a hexadecimal RGB triplet or as one of the string literals listed in <A HREF="tppmsgs/msgs0.htm#11" tppabs="http://www.nease.net/~jim/colors.htm">Color Values</A>. This property is the JavaScript reflection of the VLINK attribute of the &ltBODY&gt tag. The default value of this property is set by the user on the Colors tab of the Preferences dialog box, which is displayed by choosing General Preferences from the Options menu. You cannot set this property after the htm source has been through layout.

<P>If you express the color as a hexadecimal RGB triplet, you must use the format rrggbb. For example, the hexadecimal RGB values for salmon are red=FA, green=80, and blue=72, so the RGB triplet for salmon is "FA8072".

<H3>例子</H3>
<P>The following example sets the color of visited links to aqua using a string literal:
<PRE>
document.vlinkColor="aqua"
</PRE>
<P>The following example sets the color of active links to aqua using a hexadecimal triplet:
<PRE>
document.vlinkColor="00FFFF"
</PRE>


<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#alinkColor_property" alinkColor_property">alinkColor</A>, <A HREF="ref_a-c.htm#bgColor_property" bgColor_property">bgColor</A>, <A HREF="ref_f-g.htm#fgColor_property" fgColor_property">fgColor</A>, and <A HREF="ref_h-l.htm#linkColor_property" linkColor_property">linkColor</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="window_object"><H2>window object</H2></A>
<P>The top-level object for each document, location, and history object group.


<H3>语法</H3>
<P>To define a window, use the open method:
<PRE>
<I>windowVar</I> = window.open("<I>URL</I>", "<I>windowName</I>" [,"<I>windowFeatures</I>"])
</PRE>
<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>windowName</I> is the window name to use in the TARGET attribute of a &LTFORM&GT or &LTA&GT tag.

<P>For details on defining a window, see the <A HREF="ref_m-q.htm#open_window_method" open_window_method">open</A> method.

<P>To use a window object's properties and methods:
<PRE>
 1. window.<I>propertyName</I>
 2. window.<I>methodName</I>(<I>parameters</I>)
 3. self.<I>propertyName</I>

⌨️ 快捷键说明

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