This topic is locked

How to getElementById()

7/13/2007 1:12:13 PM
PHPRunner General questions
C
ccuser author

Since the text fields on the html pages do not have an Id labeled,
how can I use the javacript function getElementById() to perform value entry out of a prompt() box?
Thanks for your help !

Alexey admin 7/16/2007

Hi,
use document.forms.editform.value_Fieldname.value to access text box contents.

Replace Fieldname with your actual field name.

C
ccuser author 7/16/2007

Thanks but this does not seems to work for assignment.
Something like document.forms.editform.value_Cost.value=var1 ;

doesn't populate the text field for me ?

G
gnabi 7/16/2007

Thanks but this does not seems to work for assignment.

Something like document.forms.editform.value_Cost.value=var1 ;

doesn't populate the text field for me ?


It should work as suggested above. I have following code on one of my forms and it works fine. I hope this helps.
<form name=frmTimeout >

<input type=text name=txtElapsedTime value="1" >

</form>
document.frmTimeout.txtElapsedTime.value = 99;

C
ccuser author 7/17/2007

Thanks it works



It should work as suggested above. I have following code on one of my forms and it works fine. I hope this helps.
<form name=frmTimeout >

<input type=text name=txtElapsedTime value="1" >

</form>
document.frmTimeout.txtElapsedTime.value = 99;