...

View Full Version : Java Script runtime



avles
04-19-2012, 07:45 AM
Hi,
i have multiple check box and text box for each check box.
the check box value is given as text box name
ex
Checkbox
<input type="checkbox" name="cBx" value="txtname1"/>

Textbox
<input type="text" name="txtname1" />

how to get the text box value (txtname1) on calling the below function

function get_textBox_value()
{
var c_chkBoxName = "";
var c_txtBoxValue = "";
for (var i=0; i < document.Formname.cBx.length; i++)
{
if (document.Formname.cBx[i].checked)
{
c_chkBoxName= document.Formname.cBx[i].value; //working fine...
c_txtBoxValue = document.Formname.c_chkBoxName.value; // not working... how to pass the chkbox value for c_txtBoxName
}
}
}

felgall
04-19-2012, 10:37 AM
Try

c_txtBoxValue = document.Formname[c_chkBoxName].value;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum