后台能得到CheckBox的值,但前台用javascript怎么就获得不到正确的值了
后台能得到CheckBox的值,但前台用javascript怎么就获得不到正确的值了呢
便如后台得到CheckBox的value= "CATHAYA INTERNATIONAL CO.,LTD. "
前台用alert(cbo.value)查看value时显示的却是:“CATHAYA”,后面的“ INTERNATIONAL CO.,LTD.”的值会丢掉了,这是怎么回事啊!~
后台代码:
sb.Append( " <table width=440 border=1 style= 'FONT-SIZE:9pt ' cellpadding=0 cellspacing=0> ");
int index = 1;
foreach(DataRow dr in ds.Tables[0].Rows)
{
string cbovalue = dr[ "name "].ToString();
sb.Append( " <tr onmouseover= 'bg0(this) ' onmouseout= 'bg1(this) '> <td width=36px align=center> <input type= 'checkbox ' onclick= 'custchecked(this) ' value= "+cbovalue+ "> </td> <td width=35 align=center> "+(index++)+ " </td> <td width=79 align=center> "+dr[ "code "].ToString()+ " </td> <td width=220 align=left> "+dr[ "name "].ToString()+ " </td> <td width=80> "+dr[ "country "].ToString()+ " </td> </tr> ");
};
sb.Append( " </table> ");
前台js
function custchecked(cbo)
{
alert(cbo.value)
}
------解决方案--------------------checkbox属性要用引号括起来 "... value= ' " + cbovalue + " '> ... "