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

📄 ref_d-e.htm

📁 J2EE课程设计资料集合 交你怎么样设计现在流行的J2EE组件开发 JavaScript和servlet开发 怎么样实现页面验证和跳转
💻 HTM
📖 第 1 页 / 共 3 页
字号:
2. <I>textName</I>.defaultValue
3. <I>textareaName</I>.defaultValue
</PRE>
<P><I>passwordName</I> is either the value of the NAME attribute of a password object or an element in the <I>elements</I> array.
<BR><I>textName</I> is either the value of the NAME attribute of a text object or an element in the <I>elements</I> array.
<BR><I>textareaName</I> is either the value of the NAME attribute of a textarea object or an element in the <I>elements</I> array.

<H3>Property of</H3>
<P><A HREF="ref_m-q.htm#password_object" tppabs="http://www.nease.net/~jim/ref_m-q.htm#password_object">password</A>, <A HREF="ref_t-z.htm#text_object" tppabs="http://www.nease.net/~jim/ref_t-z.htm#text_object">text</A>, <A HREF="ref_t-z.htm#textarea_object" tppabs="http://www.nease.net/~jim/ref_t-z.htm#textarea_object">textarea</A>

<H3>描述</H3>
<P>The initial value of defaultValue differs for each object:
<LI>For text objects, it initially reflects the value of the VALUE attribute.
<LI>For textarea objects, it initially reflects the value specified between the &ltTEXTAREA&gt and &lt/TEXTAREA&gt tags.
<LI>For password objects, it initially is null (for security reasons), regardless of the value of the VALUE attribute.

<P>Setting defaultValue programatically overrides the initial setting. If you programatically set defaultValue for the password object and then evaluate it, JavaScript returns the current value.

<P>You can set the defaultValue property at any time. The display of the related object does not update when you set the defaultValue property, only when you set the value property.

<H3>例子</H3>
<P>The following function evaluates the defaultValue property of objects on the <I>surfCity</I> form and displays the values in the <I>msgWindow</I> window:
<PRE>
function defaultGetter() {
   msgWindow=window.open("")
   msgWindow.document.write("hidden.defaultValue is " +
      document.surfCity.hiddenObj.defaultValue + "&ltBR&gt")
   msgWindow.document.write("password.defaultValue is " +
      document.surfCity.passwordObj.defaultValue + "&ltBR&gt")
   msgWindow.document.write("text.defaultValue is " +
      document.surfCity.textObj.defaultValue + "&ltBR&gt")
   msgWindow.document.write("textarea.defaultValue is " +
      document.surfCity.textareaObj.defaultValue + "&ltBR&gt")
   msgWindow.document.close()
}
</PRE>

<H3>See also</H3>
<LI><A HREF="ref_t-z.htm#value_property" tppabs="http://www.nease.net/~jim/ref_t-z.htm#value_property">value</A> property
<!------------------------------------------------------------------------------------------------->
<HR>
<A NAME="document_object"><H2>document object</H2> </A>
<P>Contains information on the current document, and provides methods for displaying htm output to the user.


<H3>语法</H3>
<P>To define a document object, use standard htm 语法:
<PRE>
&LTBODY
   BACKGROUND="<I>backgroundImage</I>"
   BGCOLOR="<I>backgroundColor</I>"
   TEXT="<I>foregroundColor</I>"
   LINK="<I>unfollowedLinkColor</I>"
   ALINK="<I>activatedLinkColor</I>"
   VLINK="<I>followedLinkColor</I>"
   [onLoad="<I>handlerText</I>"]
   [onUnload="<I>handlerText</I>"]&GT
&LT/BODY&GT
</PRE>
<I>BACKGROUND</I> specifies an image that fills the background of the document.
<BR><I>BGCOLOR</I>, <I>TEXT</I>, <I>LINK</I>, <I>ALINK</I>, and <I>VLINK</I> are color specifications expressed as a hexadecimal RGB triplet (in the format "rrggbb" or "#rrggbb") 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>.

<P>To use a document object's properties and methods:
<PRE>
1. document.<I>propertyName</I>
2. document.<I>methodName</I>(<I>parameters</I>)
</PRE>
<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_t-z.htm#window_object" tppabs="http://www.nease.net/~jim/ref_t-z.htm#window_object">window</A>


<H3>描述</H3>
<P>An htm document consists of a &LTHEAD&GT and &LTBODY&GT tag. The &LTHEAD&GT includes information on the document's title and base (the absolute URL base to be used for relative URL links in the document). The &LTBODY&GT tag encloses the body of a document, which is defined by the current URL. The entire body of the document (all other htm elements for the document) goes within the &LTBODY&GT tag.

<P>You can load a new document by using the <A HREF="ref_h-l.htm#location_object" tppabs="http://www.nease.net/~jim/ref_h-l.htm#location_object">location</A> object.

<P>You can reference the anchors, forms, and links of a document by using the <I>anchors, forms,</I> and <I>links</I> arrays. These arrays contain an entry for each anchor, form, or link in a document.


<H3>Properties</H3>
<LI><A HREF="ref_a-c.htm#alinkColor_property" tppabs="http://www.nease.net/~jim/ref_a-c.htm#alinkColor_property">alinkColor</A> reflects the ALINK attribute
<LI><A HREF="ref_a-c.htm#anchor_object" tppabs="http://www.nease.net/~jim/ref_a-c.htm#anchor_object">anchors</A> is an array reflecting all the anchors in a document
<LI><A HREF="ref_a-c.htm#bgColor_property" tppabs="http://www.nease.net/~jim/ref_a-c.htm#bgColor_property">bgColor</A> reflects the BGCOLOR attribute
<LI><A HREF="ref_a-c.htm#cookie_property" tppabs="http://www.nease.net/~jim/ref_a-c.htm#cookie_property">cookie</A> specifies a cookie
<LI><A HREF="ref_f-g.htm#fgColor_property" tppabs="http://www.nease.net/~jim/ref_f-g.htm#fgColor_property">fgColor</A> reflects the TEXT attribute
<LI><A HREF="ref_f-g.htm#form_object" tppabs="http://www.nease.net/~jim/ref_f-g.htm#form_object">forms</A> is an array reflecting all the forms in a document
<LI><A HREF="ref_h-l.htm#lastModified_property" tppabs="http://www.nease.net/~jim/ref_h-l.htm#lastModified_property">lastModified</A> reflects the date a document was last modified
<LI><A HREF="ref_h-l.htm#linkColor_property" tppabs="http://www.nease.net/~jim/ref_h-l.htm#linkColor_property">linkColor</A> reflects the LINK attribute
<LI><A HREF="ref_h-l.htm#link_object" tppabs="http://www.nease.net/~jim/ref_h-l.htm#link_object">links</A> is an array reflecting all the links in a document
<LI><A HREF="ref_h-l.htm#location_property" tppabs="http://www.nease.net/~jim/ref_h-l.htm#location_property">location</A> reflects the complete URL of a document
<LI><A HREF="ref_r-r.htm#referrer_property" tppabs="http://www.nease.net/~jim/ref_r-r.htm#referrer_property">referrer</A> reflects the URL of the calling document
<LI><A HREF="ref_t-z.htm#title_property" tppabs="http://www.nease.net/~jim/ref_t-z.htm#title_property">title</A> reflects the contents of the &LTTITLE&GT tag
<LI><A HREF="ref_t-z.htm#vlinkColor_property" tppabs="http://www.nease.net/~jim/ref_t-z.htm#vlinkColor_property">vlinkColor</A> reflects the VLINK attribute

<P>The following objects are also properties of the document object:
<LI><A HREF="ref_a-c.htm#anchor_object" tppabs="http://www.nease.net/~jim/ref_a-c.htm#anchor_object">anchor</A>
<LI><A HREF="ref_f-g.htm#form_object" tppabs="http://www.nease.net/~jim/ref_f-g.htm#form_object">form</A>
<LI><A HREF="ref_h-l.htm#history_object" tppabs="http://www.nease.net/~jim/ref_h-l.htm#history_object">history</A>
<LI><A HREF="ref_h-l.htm#link_object" tppabs="http://www.nease.net/~jim/ref_h-l.htm#link_object">link</A>


<H3>Methods</H3>
<LI><A HREF="ref_a-c.htm#clear_method" tppabs="http://www.nease.net/~jim/ref_a-c.htm#clear_method">clear</A>
<LI><A HREF="ref_a-c.htm#close_document_method" tppabs="http://www.nease.net/~jim/ref_a-c.htm#close_document_method">close</A>
<LI><A HREF="ref_m-q.htm#open_document_method" tppabs="http://www.nease.net/~jim/ref_m-q.htm#open_document_method">open</A>
<LI><A HREF="ref_t-z.htm#write_method" tppabs="http://www.nease.net/~jim/ref_t-z.htm#write_method">write</A>
<LI><A HREF="ref_t-z.htm#writeln_method" tppabs="http://www.nease.net/~jim/ref_t-z.htm#writeln_method">writeln</A>


<H3>Event handlers</H3>
<LI>None. The onLoad and onUnload event handlers are specified in the &LTBODY&GT tag but are actually event handlers for the window object.


<H3>例子</H3>
<P>The following example creates two frames, each with one document. The document in the first frame contains links to anchors in the document of the second frame. Each document defines its colors.

<P>DOC0.htm, which defines the frames, contains the following code:
<XMP>
<htm>
<HEAD>
<TITLE>Document object example</TITLE>
</HEAD>
<FRAMESET COLS="30%,70%">
<FRAME SRC="tppmsgs/msgs0.htm#9" tppabs="http://www.nease.net/~jim/doc1.htm" NAME="frame1">
<FRAME SRC="tppmsgs/msgs0.htm#10" tppabs="http://www.nease.net/~jim/doc2.htm" NAME="frame2">
</FRAMESET>
</htm>
</XMP>

<P>DOC1.htm, which defines the content for the first frame, contains the following code:
<XMP>
<htm>
<SCRIPT>
</SCRIPT>
<BODY
   BGCOLOR="antiquewhite"
   TEXT="darkviolet"
   LINK="fuchsia"
   ALINK="forestgreen"
   VLINK="navy">
<P><B>Some links</B>
<LI><A HREF="tppmsgs/msgs0.htm#10" tppabs="http://www.nease.net/~jim/doc2.htm#numbers" TARGET="frame2">Numbers</A>
<LI><A HREF="tppmsgs/msgs0.htm#10" tppabs="http://www.nease.net/~jim/doc2.htm#colors" TARGET="frame2">Colors</A>
<LI><A HREF="tppmsgs/msgs0.htm#10" tppabs="http://www.nease.net/~jim/doc2.htm#musicTypes" TARGET="frame2">Music types</A>
<LI><A HREF="tppmsgs/msgs0.htm#10" tppabs="http://www.nease.net/~jim/doc2.htm#countries" TARGET="frame2">Countries</A>
</BODY>
</htm>
</XMP>

<P>DOC2.htm, which defines the content for the second frame, contains the following code:
<XMP>
<htm>
<SCRIPT>
</SCRIPT>
<BODY
   BGCOLOR="oldlace" onLoad="alert('Hello, World.')"
   TEXT="navy">
<P><A NAME="numbers"><B>Some numbers</B></A>
<LI>one
<LI>two
<LI>three
<LI>four
<LI>five
<LI>six
<LI>seven
<LI>eight
<LI>nine
<P><A NAME="colors"><B>Some colors</B></A>
<LI>red
<LI>orange
<LI>yellow
<LI>green
<LI>blue
<LI>purple
<LI>brown
<LI>black
<P><A NAME="musicTypes"><B>Some music types</B></A>
<LI>R&B
<LI>Jazz
<LI>Soul
<LI>Reggae
<LI>Rock
<LI>Country
<LI>Classical
<LI>Opera
<P><A NAME="countries"><B>Some countries</B></A>
<LI>Afghanistan
<LI>Brazil
<LI>Canada
<LI>Finland
<LI>India
<LI>Italy
<LI>Japan
<LI>Kenya
<LI>Mexico
<LI>Nigeria
</BODY>
</htm>
</XMP>


<H3>See also</H3>
<LI><A HREF="ref_f-g.htm#frame_object" tppabs="http://www.nease.net/~jim/ref_f-g.htm#frame_object">frame</A> and <A HREF="ref_t-z.htm#window_object" tppabs="http://www.nease.net/~jim/ref_t-z.htm#window_object">window</A> objects


<!------------------------------------------------------------------------------------------------->
<HR>

⌨️ 快捷键说明

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