[This was submitted as a bug to Opera; I'm posting it here, after not
seeing mention of this in a newsgroup search]:
In HTML 4.01, a <button> element can take 1 of 3 types:
type=submit (default)
type=reset
type=button
The Javascript to create a button element dynamically is
elem = document.create Element('button ');
elem.type = 'reset';
Running this code in Opera 7.54 gives the message:
"DOMExcepti on: NO_MODIFICATION _ALLOWED_ERR"
My intuition is that the official Opera.com response will be that this
is as required by the DOM spec, which lists "type" as a readonly property.
And I'll give you that, but how can the spec be correct? It refers to the
HTML 4.01 spec, which lists the 3 possible values for type; but the DOM
interface shows no other method for altering the value of type.
In other words, how do I use Javascript to create the equivalent of either
<button name="rset" type="reset">Re set Button</button>
or
<button name="push" type="button">P ush Button</button>
??
For what it's worth, Mozilla makes the "type" property read/write; and
IE requires its own bizarre argument to createElement (as:
elem = document.create Element('<butto n type="reset" value="Reset">R eset</button>')
hj
Comment