2 Replies - 1353 Views - Last Post: 22 May 2009 - 05:13 PM

#1 Techno Guy  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 27-May 08

add a sting in between "document.myform." and ".value&q

Post icon  Posted 22 May 2009 - 02:39 AM

Hi,

I want to be able to add a string in between "document.myform." and ".value=intAmount" how would I do this?
I tried just stuffing it in there, but that didn't work :crazy:

What I have:
<HTML>
<HEAD>
<TITLE>Test Input </TITLE>
<script LANGUAGE="Javascript">
  function fnCalculateEquip(intAmount, intCalculate, strIdName ) {
var strIdNameComplete = strIdName+"OUT";

	intAmount=parseFloat(intAmount); // find number (parseFloat)
	intAmount=intAmount*intCalculate;		 //convert to dollars and cents
	document.myform.inputBoxOUT.value=intAmount
	//document.formname.control[1].value

  }
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="myform" ACTION="">
in<INPUT TYPE="text" NAME="inputBox" VALUE=""  onkeyup="fnCalculateEquip(this.value, 2, inputBoxOUT)">
out<INPUT TYPE="text" NAME="inputBoxOUT" VALUE="">
</FORM>
</BODY>
</HTML>


What I want:
<HTML>
<HEAD>
<TITLE>Test Input </TITLE>
<script LANGUAGE="Javascript">
  function fnCalculateEquip(intAmount, intCalculate, strIdName ) {
var strIdNameComplete = strIdName+"OUT";

	intAmount=parseFloat(intAmount); 
	intAmount=intAmount*intCalculate;  
	document.myform.strIdNameComplete.value=intAmount //I want to just put it into here, but it doesn't really like that :(

  }
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="myform" ACTION="">
in<INPUT TYPE="text" NAME="inputBox" VALUE=""  onkeyup="fnCalculateEquip(this.value, 2, this.name)">
out<INPUT TYPE="text" NAME="inputBoxOUT" VALUE="">
</FORM>
</BODY>
</HTML>


Is This A Good Question/Topic? 0
  • +

Replies To: add a sting in between "document.myform." and ".value&q

#2 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,070
  • Joined: 10-May 07

Re: add a sting in between "document.myform." and ".value&q

Posted 22 May 2009 - 02:51 AM

You don't want to force the value of your form item, you use that to gather what it's set to.

If I understand what you are trying to do, you want to return the value of intAmount from the function.
Was This Post Helpful? 0
  • +
  • -

#3 Techno Guy  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 27-May 08

Re: add a sting in between "document.myform." and ".value&q

Posted 22 May 2009 - 05:13 PM

Soo... Could you give me a little example of what your mean please?
I don't really get what you mean.
Am I supposed to have the function in the "inputBoxOUT" input....
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1