I need to dynamic create input element in some cases, and I use javascript to do that, like the following code:
and in some other place, I need to use JavaScript to access the value,
like :
document.forms[0]['fieldName'].value
The code works fine in FireFox,
but in IE(6), I found that the name of the inputElement is gone.
So I wrote some other script to change input element's name,
It still not work( but works in FireFox).
I have a input element in form, and use a button to trigger the following function
in FireFox, the name is changed, but in IE, the name is not changed, and 'def' is not exist in the form.
Are there any one know what's going on?
Code:
.... var inputElement = document.createElement("input"); this.inputElement.name= "fieldName"; this.inputElement.type = "text"; this.inputElement.value = "somevalue"; ....
like :
document.forms[0]['fieldName'].value
The code works fine in FireFox,
but in IE(6), I found that the name of the inputElement is gone.
So I wrote some other script to change input element's name,
It still not work( but works in FireFox).
I have a input element in form, and use a button to trigger the following function
Code:
function create() { alert("abc:" + document.forms[0]['abc'].value ); document.forms[0]['abc'].setAttribute("name", "def"); alert("def:" + document.forms[0]['def'] ); }
Are there any one know what's going on?
Comment