EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

outerText property

Sets or retrieves the text of the object.

Syntax

JavaScript

p = object.outerText

Property values

Type: String

the text.

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 JavaScript 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.

Examples

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='&lt;P ID=oPara&gt; And back again&lt;/P&gt;'">Reset</button>

See also

a
abbr
address
area
article
aside
b
bdo
blockQuote
body
br
button
caption
cite
code
col
colGroup
custom
dd
del
dfn
div
dl
dt
em
embed
fieldSet
figcaption
figure
footer
form
frame
head
header
hgroup
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
kbd
label
legend
li
map
mark
menu
nav
object
ol
optGroup
option
p
pre
q
rt
ruby
s
samp
section
select
small
span
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
tr
u
ul
var
insertAdjacentText

 

 

Anzeigen:
© 2014 Microsoft. Alle Rechte vorbehalten.