JavaScript Reference/Javascript Methods/clearAttributes

Материал из Web эксперт
Перейти к: навигация, поиск

"clearAttributes()" Example

    
<html>
<body>
<script language="JavaScript">
    function function1() {
        document.all.myP.clearAttributes(); 
    } 
</script>
<p id="myP" style="color:red">This text has the style and id attributes.</p>
<p id="myP1" style="color:red">This text has the style and id1 attributes.</p>
<button onclick="function1();">Clear attributes()</button>
</body>
</html>



"clearAttributes()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <acronym>                     |
|                |<address>                       <applet>                      |
|                |<area>                          <b>                           |
|                |<base>                          <basefont>                    |
|                |<bdo>                           <bgsound>                     |
|                |<big>                           <blockquote>                  |
|                |<body>                          <br>                          |
|                |<button>                        <caption>                     |
|                |<center>                        <cite>                        |
|                |<code>                          <col>                         |
|                |<colgroup>                      <comment>                     |
|                |<custom>                        <dd>                          |
|                |<del>                           <dfn>                         |
|                |<dir>                           <div>                         |
|                |<dl>                            <dt>                          |
|                |<em>                            <embed>                       |
|                |<fieldset>                      <font>                        |
|                |<form>                          <frame>                       |
|                |<frameset>                      <head>                        |
|                |<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>                            <link>                        |
|                |<listing>                       <map>                         |
|                |<marquee>                       <menu>                        |
|                |<object>                        <ol>                          |
|                |<option>                        <p>                           |
|                |<plaintext>                     <pre>                         |
|                |<q>                             <s>                           |
|                |<samp>                          <script>                      |
|                |<select>                        <small>                       |
|                |<span>                          <strike>                      |
|                |<strong>                        <sub>                         |
|                |<sup>                           <table>                       |
|                |<tbody>                         <td>                          |
|                |<textarea>                      <tfoot>                       |
|                |<th>                            <thead>                       |
|                |<title>                         <tr>                          |
|                |<tt>                            <u>                           |
|                |<ul>                            <var>                         |
|                |<xmp>                                                         |
+----------------+--------------------------------------------------------------+



"clearAttributes()" Syntax, Parameters and Note

Note:
Removes all attributes, except name and id, from an element.
    
Syntax:
    
document.all.elementID.clearAttributes()