Sets or retrieves the text of the object. dhtml语法 HTML | N/A |
---|
Scripting | object.outerText [ = sTxt ] |
---|
DHTML可能的值 sTxt | String that
specifies or receives the text. |
The property is read/write.
The property has no default value. Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
remarks the outertext property is read-only on the html, tbody, td, tfoot, th, thead, and tr objects. when this property is set, the given string completely replaces the original text in the object. you can set this property only after the onload event fires on the window. when dynamically creating a tag using textrange, innerhtml, or outerhtml, use microsoft® jscript® to create new events to handle the newly formed tags. microsoft visual basic® scripting edition (vbscript) is not supported. you can change the value of the title element using the document.title property. to change the contents of the table, tfoot, thead, and tr elements, use the table object model. for example, use the rowindex property or the rows collection to retrieve a reference to a specific table row. you can add or delete rows using the insertrow and deleterow methods. to retrieve a reference to a specific cell, use the cellindex property or the cells collection. you can add or delete rows using the insertcell and deletecell methods. to change the content of a particular cell, use the innerhtml property.
DHTML代码范例
This example uses the outerText property to replace an object's content; the object itself also is replaced. <DIV ID=oDiv>
<P ID=oPara>Here's the text that will change.</P>
</DIV>
:
<BUTTON onclick="oPara.outerText='WOW!
It changed!'">Change text</BUTTON>
<BUTTON onclick="oDiv.innerHTML='<P ID=oPara>
And back again</P>'">Reset</BUTTON> This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
是否符合公共标准
There is no public standard that applies to this property.
Applies To |
A,
ACRONYM,
ADDRESS,
APPLET,
AREA,
B,
BDO,
BGSOUND,
BIG,
BLOCKQUOTE,
BR,
BUTTON,
CENTER,
CITE,
CODE,
COMMENT,
CUSTOM,
DD,
DEL,
DFN,
DIR,
DIV,
DL,
DT,
EM,
EMBED,
FIELDSET,
FONT,
FORM,
hn,
HR,
HTML,
I,
IFRAME,
IMG,
INPUT type=button,
INPUT type=checkbox,
INPUT type=file,
INPUT type=hidden,
INPUT type=image,
INPUT type=password,
INPUT type=radio,
INPUT type=reset,
INPUT type=submit,
INPUT type=text,
INS,
KBD,
LABEL,
LEGEND,
LI,
LISTING,
MAP,
MARQUEE,
MENU,
nextID,
NOBR,
OBJECT,
OL,
P,
PLAINTEXT,
PRE,
Q,
RT,
RUBY,
S,
SAMP,
SELECT,
SMALL,
SPAN,
STRIKE,
STRONG,
SUB,
SUP,
TABLE,
TBODY,
TD,
TEXTAREA,
TFOOT,
TH,
THEAD,
TR,
TT,
U,
UL,
VAR,
WBR,
XMP | |
更多语法参考 insertAdjacentText
|