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

📄 ref_t-z.htm

📁 javascript函数大全HTML javascript函数大全HTML
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<htm><title>网络时空——网页制作</title>
<link rel="shortcut icon" href="../../../../ccisn.ico">
<link href="../../../../common.css" type="text/css" rel="stylesheet"><style type="text/css">
<!--
td,p,div {font-size:9pt;font-family:宋体;}
BODY { font-family:宋体; margin-left:0; margin-top:0; font-size:9pt; background-color:#ffffff;}
A { font-size: 9pt;color:#0000aa; text-decoration:underline;font-family:宋体; }
A:hover,A:active{ color:#FF8019; text-decoration:underline;}
A.top{color:#ffffff;font-size:9pt}
-->
</style>
<body bgcolor="#ffffff" text="#000000" link="#003399" alink="#ff9900" vlink="#000000" background="../../../images/b01.jpg">
<A NAME="tan_method"><H2>tan method</H2></A>
<P>
Returns the tangent of a number.

<H3>语法</H3>
<PRE>Math.tan(<I>number</I>)</PRE>
<P><I>number</I> is a numeric expression representing the size of an angle in radians, or a property of an existing object.

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

<H3>描述</H3>
<P>The tan method returns a numeric value which represents the tangent of the angle.

<H3>例子</H3>
<PRE>
//Displays the value 0.9999999999999999
document.write("The tangent of pi/4 radians is " +
   Math.tan(Math.PI/4))

//Displays the value 0
document.write("&ltP&gtThe tangent of 0 radians is " +
   Math.tan(0))
</PRE>

<H3>相关</H3>
<LI><A HREF="ref_a-c.htm#acos_method" acos_method">acos</A>, <A HREF="ref_a-c.htm#asin_method" asin_method">asin</A>, <A HREF="ref_a-c.htm#atan_method" atan_method">atan</A>, <A HREF="ref_a-c.htm#cos_method" cos_method">cos</A>, <A HREF="ref_s-s.htm#sin_method" sin_method">sin</A> methods

<!----------------------------------------------------------------->
<HR>
<A NAME="target_property"><H2>target property</H2></A>
<P>
For form, a string specifying the name of the window that responses go to after a form has been submitted. For link, a string specifying the name of the window that displays the content of a clicked hypertext link.

<H3>语法</H3>
<PRE>
1. <I>formName</I>.target
2. links[<I>index</I>].target
</PRE>
<P><I>formName</I> is either the name of a form or an element in the <I>forms</I> array.
<BR><I>index</I> is an integer representing a link object.

<H3>Property of</H3>
<P><A HREF="ref_f-g.htm#form_object" form_object">form</A>, <A HREF="ref_h-l.htm#link_object" link_object">link</A>

<H3>描述</H3>
<P>The target property initially reflects the TARGET attribute of the &ltFORM&gt and &ltA&gt tags; however, setting target overrides these attributes.

<P>The target property cannot be assigned the value of a JavaScript expression or variable.

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

<P>Certain values of the target property may require specific values for other form properties. See <A HREF="tppmsgs/msgs0.htm#3" tppabs="http://www.ics.uci.edu/pub/ietf/htm/rfc1867.txt" TARGET="_top">RFC 1867</A> for more information.

<H3>例子</H3>
<P>The following example specifies that responses to the <I>musicInfo</I> form are displayed in the "msgWindow" window:
<PRE>document.musicInfo.target="msgWindow"</PRE>

<H3>相关</H3>
<P>For form:
<LI><A HREF="ref_a-c.htm#action_property" action_property">action</A>, <A HREF="ref_d-e.htm#encoding_property" encoding_property">encoding</A>, <A HREF="ref_m-q.htm#method_property" method_property">method</A> properties
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="text_object"><H2>text object</H2></A>
<P>A text input field on an htm form. A text field lets the user enter a word, phrase, or series of numbers.


<H3>语法</H3>
<P>To define a text object, use standard htm 语法 with the addition of the onBlur, on Change, onFocus, and onSelect event handlers:
<PRE>
&LTINPUT
   TYPE="text"
   NAME="<I>textName</I>"
   VALUE="<I>textValue</I>"
   SIZE=<I>integer</I>
   [onBlur="<I>handlerText</I>"]
   [onChange="<I>handlerText</I>"]
   [onFocus="<I>handlerText</I>"]
   [onSelect="<I>handlerText</I>"]&GT
</PRE>
<I>NAME="textName"</I> specifies the name of the text object. You can access this value using the name property.
<BR><I>VALUE="textValue"</I> specifies the initial value of the text object. You can access this value using the defaultValue property.
<BR><I>SIZE=integer</I> specifies the number of characters the text object can accommodate without scrolling.

<P>To use a text object's properties and methods:
<PRE>
1. <I>textName</I>.<I>propertyName</I>
2. <I>textName</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>textName</I> is the value of the NAME attribute of a text 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 text 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>描述</H3>
<P>A text object on a form looks as follows:
<FORM>
<P><B>Last name:</B> <INPUT TYPE="text" VALUE="Salamone" SIZE=25>
</FORM>
<P>A text object is a form element and must be defined within a &LTFORM&GT tag.

<P>text objects can be updated (redrawn) dynamically by setting the value property (this.value).


<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 text 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><A HREF="ref_m-q.htm#onBlur_event" onBlur_event">onBlur</A>
<LI><A HREF="ref_m-q.htm#onChange_event" onChange_event">onChange</A>
<LI><A HREF="ref_m-q.htm#onFocus_event" onFocus_event">onFocus</A>
<LI><A HREF="ref_m-q.htm#onSelect_event" onSelect_event">onSelect</A>


<H3>例子</H3>
<P><B>Example 1.</B> The following example creates a text object that is 25 characters long. The text field appears immediately to the right of the words "Last name:". The text field is blank when the form loads.
<XMP>
<B>Last name:</B> <INPUT TYPE="text" NAME="last_name" VALUE="" SIZE=25>
</XMP>

<P><B>Example 2.</B> The following example creates two text objects on a form. Each object has a default value. The <I>city</I> object has an onFocus event handler that selects all the text in the field when the user tabs to that field. The <I>state</I> object has an onChange event handler that forces the value to upper case.
<XMP>
<FORM NAME="form1">
<BR><B>City: </B><INPUT TYPE="text" NAME="city" VALUE="Anchorage"
   SIZE="20" onFocus="this.select()">
<B>State: </B><INPUT TYPE="text" NAME="state" VALUE="AK" SIZE="2"
   onChange="this.value=this.value.toUpperCase()">
</FORM>
</XMP>
<P>相关 the 例子 for the <A HREF="ref_m-q.htm#onBlur_event" onBlur_event">onBlur</A>, <A HREF="ref_m-q.htm#onChange_event" onChange_event">onChange</A>, <A HREF="ref_m-q.htm#onFocus_event" onFocus_event">onFocus</A>, and <A HREF="ref_m-q.htm#onSelect_event" onSelect_event">onSelect</A> event handlers.


<H3>相关</H3>
<LI><A HREF="ref_f-g.htm#form_object" form_object">form</A>, <A HREF="ref_m-q.htm#password_object" password_object">password</A>, <A HREF="ref_s-s.htm#string_object" string_object">string</A>, and <A HREF="ref_t-z.htm#textarea_object" textarea_object">textarea</A> objects


<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="text_property"><H2>text property</H2></A>
<P>
A string specifying the text that follows an &ltOPTION&gt tag in a select object.

<H3>语法</H3>
<PRE><I>selectName</I>.options[<I>index</I>].text</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>The text property initially reflects the text that follows an &ltOPTION&gt tag in a select object.

<P>You can set the text property at any time; however, the following effects result:
<LI>The value of the property changes.
<LI>The text displayed by the option in the select object does not change.

<P>Be careful if you change the text property. If you evaluate the property after you change it, the property contains the new value, not the value that is displayed onscreen.

<H3>例子</H3>
<P>In the following example, the <I>getChoice()</I> function returns the value of the text property for the selected option. The <B>for</B> loop evaluates every option in the <I>musicType</I> select object. The <B>if</B> statement finds the option that is selected.
<PRE>
function getChoice() {
   for (var i = 0; i < document.musicForm.musicType.length; i++) {
      if (document.musicForm.musicType.options[i].selected == true) {
         return document.musicForm.musicType.options[i].text
      }
   }
   return null
}
</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>

<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="textarea_object"><H2>textarea object</H2></A>
<P>A multiline input field on an htm form. A textarea field lets the user enter words, phrases, or numbers.


<H3>语法</H3>
<P>To define a text area, use standard htm 语法 with the addition of the onBlur, onChange, onFocus, and onSelect event handlers:
<PRE>
&LTTEXTAREA
   NAME="<I>textareaName</I>"
   ROWS="<I>integer</I>"
   COLS="<I>integer</I>"
   WRAP="off|virtual|physical"
   [onBlur="<I>handlerText</I>"]
   [onChange="<I>handlerText</I>"]
   [onFocus="<I>handlerText</I>"]
   [onSelect="<I>handlerText</I>"]&GT
   <I>textToDisplay</I>
&LT/TEXTAREA&GT
</PRE>
<I>NAME="textareaName"</I> specifies the name of the textarea object. You can access this value using the name property.
<BR><I>ROWS="integer"</I> and <I>COLS="integer"</I> define the physical size of the displayed input field in numbers of characters.
<BR><I>textToDisplay</I> specifies the initial value of the textarea object. A textarea allows only ASCII text, and new lines are respected. You can access this value using the defaultValue property.
<P>
The WRAP attribute controls word wrapping inside the TEXTAREA. The value "off" is default
and lines are sent exactly as typed. The value "virtual" wraps in the display but are sent exactly as typed.
The value "physical" wraps in the display and sends new-lines at the wrap points as if new-lines had been
entered. 

<P>To use a textarea object's properties and methods:
<PRE>
1. <I>textareaName</I>.<I>propertyName</I>
2. <I>textareaName</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>textareaName</I> is the value of the NAME attribute of a textarea 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 textarea 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>描述</H3>

⌨️ 快捷键说明

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