RadioListSelectCheck方法有5个参数:
Container: gridviewID,
RadioName: RadioButton的ID
isDelete: 是否是删除的按钮
notselectmsg:未选择是提示的信息
delmsg:删除时的DoubleConfirm提示信息
RadioListSelectCheck方法有5个参数:
Container: gridviewID,
RadioName: RadioButton的ID
isDelete: 是否是删除的按钮
notselectmsg:未选择是提示的信息
delmsg:删除时的DoubleConfirm提示信息
Code
<script type="text/javascript">
function RadioListSelectCheck(Container, RadioName,isDelete,notselectmsg,delmsg)
{
var myForm,objRadio;
var checked=false;
myForm=document.forms[0];
///alert(myForm);
for(var i=0;i<myForm.length;i++)
{
if(myForm.elements[i].type=="radio")
{
objRadio=myForm.elements[i];
///alert(objRadio.name);
if(objRadio.name.indexOf(Container)>-1 && objRadio.name.indexOf(RadioName)>-1)
{
//alert(objRadio.name);
if(objRadio.checked)
{
checked = true;
}
}
}
}
if(!checked)
{
if(notselectmsg == 'undefined' || notselectmsg == null || notselectmsg == '')
window.alert('你未选定要操作的数据项,请选择!');
else
window.alert(notselectmsg);
return false;
}
else if(isDelete)
{
if(delmsg == 'undefined' || delmsg == null || delmsg == '')
return confirm('您确认删除选定的数据项么?')
else
return confirm(delmsg)
}
//use demo: OnClientClick="javascript:return RadioListSelectCheck('gvOrganizationInfo','rbSelect',true,'select msg','delete msg' );"
//delfault: OnClientClick="javascript:return RadioListSelectCheck('gvOrganizationInfo','rbSelect');"
}
</script>