JavaScript Reference/Javascript Methods/removeAttribute — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:22, 26 мая 2010
"removeAttribute()" Example
<source lang="javascript">
<html> <body> <script language="JavaScript">
function function1(){ var m = document.getElementById("myDiv").removeAttribute("id"); document.all.myB.innerText = "Click again"; if (m == true) { alert("Attribute removed"); } }
</script>
<input id="myB" type="button" value="Remove id attribute" onclick="function1();"> </body> </html>
</source>
"removeAttribute()" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> | | |<base> <basefont> | | | <bgsound> |
| ||| |<body>
| | |<button>| | | | | |
| |<dir><col> | | |<colgroup> <comment> | | |<custom>
| | | || | |
- | | | <embed> | | |<fieldset> | | |<form> <frame> | | |<frameset> <head> | | |<hn>
|| |<html> | | |<iframe> <img> | | |<input> <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"> | | |<isindex> | | |<label> <legend> |
| |- <link> | | |<listing> <map> | | |<marquee> <menu> | | |<meta> <nobr> | | |<noframes> <noscript> | | |<object>
| | |<optgroup> <option> | | |
<param> | | |<plaintext>
| | |runtimeStyle | | || | |<script> <select> | | | | | || | |style | | || | |<tbody>
| | |<textarea> <tfoot> |
| |<thead> | | |<title> | | | | | | | | |
<xmp> | +----------------+--------------------------------------------------------------+ </source> "removeAttribute()" Syntax, Parameters and Note
<source lang="javascript"> Note: Removes the specified attribute value from the element. Returns true (successful) or false (failed).
Syntax:
document.getElementById("elementID").removeAttribute(param1, param2) document.all.elementID.removeAttribute(param1, param2) // IE only Parameters: param1 Required; the name of the attribute. param2 Optional; the type of search. 1 the default for a case-sensitive search any other value for a non?case-sensitive search.
</source>