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

removeAttribute method

Removes an attribute from an object.

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5

Syntax

object.removeAttribute(strAttributeName, lFlags)

Parameters

strAttributeName [in]

Type: String

String that specifies an attribute name.

lFlags [in, optional]

Type: Integer

Integer that specifies whether to use a case-sensitive search to locate the attribute. Can be one of the following values:

1

The case of strAttributeName is respected.

0

Match strAttributeName regardless of case.

Return value

Type: Boolean

Boolean. Returns one of the following possible values:
Return valueDescription
true

The attribute was successfully removed.

false

The attribute was not removed.

 

Standards information

Remarks

removeAttribute always returns S_OK as an HRESULT value. Check the pfSuccess parameter to determine if the attribute is successfully removed.

If your pages are displayed in a Windows Store app using JavaScript or a Windows Store app using JavaScript, be careful when spelling attribute names. If two or more attributes have the same name—differing only in capitalization—and lFlags is set to 0, this method removes only the last attribute to be created with this name. All other attributes of the same name are ignored.

The strAttributeName parameter requires the name of the desired content attribute and not the Document Object Model (DOM) attribute.

The strAttributeName parameter is not case sensitive. As a result, the lFlags parameter is no longer supported and should not be used.

The methods support event handlers. For example, the following code example defines an event handler to call a function called SomeFunction when the body of the page is loaded.


document.body.setAttribute('onload', 'SomeFunction()');

removeAttribute always returns S_OK as an HRESULT value. Check the pfSuccess parameter to determine if the attribute is successfully removed.

See also

a
address
area
b
base
bgSound
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
custom
dd
dfn
div
dl
dt
em
embed
fieldSet
form
frame
head
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
kbd
label
legend
li
link
map
menu
meta
object
ol
option
p
pre
runtimeStyle
s
samp
script
select
small
span
strong
style
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
u
ul
var
Reference
getAttribute
setAttribute

 

 

Anzeigen:
© 2014 Microsoft. Alle Rechte vorbehalten.