View Full Version : Trying to assign a variable the value of a hidden form, and then add a number to it.

10-22-2005, 09:11 PM
I understand that forms convert to strings, so I need to re-convert back to a number, and then add the amount I want. Then I re-assign the variable to the hidden form, and call it from a frame within the page.

I'm using:

Number(' ');

Now I'm either using it incorrectly, or there's an error somewhere else in the code. It instead adds the two strings together still. Here's what my code looks like:

if (classf == "bonus") {

var maxhp = document.forms[0].elements[4].value
var maxhp = (number(maxhp));

maxhp = maxhp + 15;

document.forms[0].elements[4].value = maxhp;


10-22-2005, 09:30 PM
Whoops, got it.

The third line of the code I listed needed to look like this:

var maxhp = Number(maxhp);

10-22-2005, 09:36 PM
in place of

posts crossed

if fine(no need for maxhp)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum