weird error

wxdqz

New Member
Okay, I'm coding along on a project, and I have an onChange on a select form input. It is supposed to check the current value, then do a test, and is supposed to change the value of a text input, but all I get is NaN in the changed field. The code follows. Any help would be appreciated.

// function for checking the skill point value onChange.
function SkillChange(value, new_value)
{
if (value < new_value)
{
change = new_value - value;
document.char.skill_points.value = skill_points - change;
}
else
{
if (value > new_value)
{
change = value - new_value;
really_new_value = skill_points + change;
document.char.skill_points.value = really_new_value;
}
else
{
return true;
}
}
}

// vars for skills
var accessorize = "";


And then in the body I have this:

<form name="char">

Accessorize: <select name="accessorize" onChange="SkillChange(accessorize, window.document.char.accessorize.options[selectedIndex].text);">
<option value=http://www.webdeveloper.com/forum/archive/index.php/"0">0
<option value="1">1
<option value="2">2
<option value="3">3
</select>

<input type="text" size="3" readonly="readonly" value="10" name="skill_points">

</form>

I've tried tons of things in the accessorize variable, and they all give me a stupid "document.char.accessorize is null or not an object" error. I've also tried putting the accessorize statement after the form, and still get the error. I'm going even further out of my mind trying to work with this.
 
Back
Top