Page 1 of 1

read variable into string

Posted: Thu Jul 10, 2003 11:38 am
by gurjit
i pass through a variable called theval which holds a value such as 'M32'
when i try to make the checkbox value true it says error

'form1.theval.[0]' is null or not an object.

it does not convert theval into M32 and pass through form1.M32[0].checked = true.

this is my code

function clicksub(theval) {
form1.theval[0].checked = true
}


i just want to check the first checkbox.

how can i convert the 'theval' parameter passed through here.

In the form all i do is

<input onclick="clicksub('<?php echo "m$loc_id$school_id";?>')" id="<?php echo "m$loc_id$school_id";?>" type="Checkbox" name="stuid[]" value="<?php echo $stuid; ?>"> <?php echo $stu_fname1; ?> <?php echo $stu_fname2; ?> <?php echo $stu_lname; ?> <?php echo "<br>"; ?>

Posted: Thu Jul 10, 2003 11:58 am
by sbe
Try form[theval+'[0]'].checked.