Sinjorenbloed
06-26-2003, 12:14 PM
Hi!
I'm working on a page and i encountered the following problem:
I have variable that contains a string. And the string-text refers to the content of a textfield in a form. When i print the variable i always get the string-text instead of the value of the textfield to which the string-text in my variable refers. This may sound complicated (or badly explained) so i'll give the code to make it more clear:
in the html-code:
<form name="frmA"
<input type="'text" name="txtB" value="XYZ">
</form>
in the javascript:
tmp="frmA.txtB.Value";
alert(tmp);
=> this prints the text "frmA.txtB.value" instead of the value "XYZ" (instead of the value of the textfield). Is there a way to use the variable 'tmp' as a reference to the content of the textfield and still let it be a string?
PS: when i type:
tmp=frmA.txtB.value;
alert(tmp);
=> in this case i DO get the content of the textfield, but now the variable 'tmp' isn't of the String-type. It's gotta be a string so i can let the string change depending on the input. Can anyone help me?
I'm working on a page and i encountered the following problem:
I have variable that contains a string. And the string-text refers to the content of a textfield in a form. When i print the variable i always get the string-text instead of the value of the textfield to which the string-text in my variable refers. This may sound complicated (or badly explained) so i'll give the code to make it more clear:
in the html-code:
<form name="frmA"
<input type="'text" name="txtB" value="XYZ">
</form>
in the javascript:
tmp="frmA.txtB.Value";
alert(tmp);
=> this prints the text "frmA.txtB.value" instead of the value "XYZ" (instead of the value of the textfield). Is there a way to use the variable 'tmp' as a reference to the content of the textfield and still let it be a string?
PS: when i type:
tmp=frmA.txtB.value;
alert(tmp);
=> in this case i DO get the content of the textfield, but now the variable 'tmp' isn't of the String-type. It's gotta be a string so i can let the string change depending on the input. Can anyone help me?