Wednesday, June 13, 2007

javascript remove attribute method

removeAttribute() Syntax, Parameters and 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.
removeAttribute() example code
<html>
<body>
<script language="JavaScript">
 
function function2() {
    document.getElementById("mvname").removeAttribute("readOnly",0); 
} 
</script>

<input type="text" id="mvname" readOnly="true" value="remove Attribute test" size="40"/> 

<input type="button" value="remove textbox's readOnly attribute" onclick="function2();">

</body>
</html>
 
Blogger Template Layout Design by [ METAMUSE ] : Code Name Gadget 1.1 Power By freecode-frecode.blogger.com & blogger.com Programming Blogs - BlogCatalog Blog Directory