Wednesday, June 13, 2007

javascript create attribute method

createAttribute() Syntax, Parameters and Note
Creates an attribute node. 
It also works with user-defined XML elements, allowing for the creation of
custom attributes.

    param1   Required; the name of the attribute.
createAttribute() example code

<script language="JavaScript">
function function1() {
    var newAttr = document.createAttribute("readOnly");
    newAttr.nodeValue = "true"

<input type="text" id="mvname" value="create Attribute test" size="40"/> 
<input type="button" value="Add readOnly attribute to textbox" onclick="function1();"> 

Blogger Template Layout Design by [ METAMUSE ] : Code Name Gadget 1.1 Power By & Programming Blogs - BlogCatalog Blog Directory