Try

function test(controlnum) {

    var theObject = eval( "document.forms[0].interest" + interest );
    theObject.value = theObject.value + 1;

}

If it's a text input that you're using, you might have to convert the values
between string and integer, something like

    theObject.value = (theObject.value.parseInt() + 1).toString();

Haven't tested the above code, it's just off the top of my head, but it's
something like that, anyway.

Hope that helps

Alistair Davidson
Senior Web Developer
Rocom New Media
www.rocomx.net


-----Original Message-----
From: Andy Ewings [mailto:[EMAIL PROTECTED]]
Sent: 24 May 2001 12:18
To: CF-Talk
Subject: OT Javascript question


I'm having a mind blank....arghhh.  I'm trying to incremtnet the value of a
control in a form by one where part of the controls name is poassed in as a
variable.  Probably best I explain with the code snippet:

function test(controlnum) {
         "document.forms[0].interest" + interest + ".value" =
eval("document.forms[0].interest" + interest + ".value") + 1;
}

I have tested using alert and the The RHS of the equation is computed
correctly.  I need to let javasript know that the LHS of the equation is an
object in the page rather than just a string but I can't remeber
how!....anyone help
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to