H
Howard Jess
[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.createElement('button');
elem.type = 'reset';
Running this code in Opera 7.54 gives the message:
"DOMException: 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">Reset Button</button>
or
<button name="push" type="button">Push 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.createElement('<button type="reset" value="Reset">Reset</button>')
hj
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.createElement('button');
elem.type = 'reset';
Running this code in Opera 7.54 gives the message:
"DOMException: 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">Reset Button</button>
or
<button name="push" type="button">Push 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.createElement('<button type="reset" value="Reset">Reset</button>')
hj