Rob wrote:
Hello all,
I have the following code:
frm.elements.['textbox_id'].innerText='some text';
this works in the IE but not in Mozilla.
It won't work in IE either - get rid of the dot between 'elements' and
['textbox_id'], try:
frm.elements['textbox_id'].innerText='some text';
Mozilla does not support innerText - it's a Microsoft standard,
not a W3C standard - so even the corrected code won't work.
How do I fill a textbox in Mozilla?
Assuming from your code above you have an input element of type text
that has an id='textbox_id', you could use:
document.getElementById('textbox_id').value = 'some text';
Also assuming you do appropriate feature testing for getElementById.
If you put a name on the input: name='textbox_id', then use:
frm.elements['textbox_id'].value = 'some text';
or
frm.textbox_id.value = 'some text';
Both of which work in IE 6 as well, though to support older browsers
you'll have to do something else.
Cheers, Rob