获得选中的单选按钮的值:
function getRadioSelValue(theradio)
{
if (theradio!=null)
{
var len = theradio.length;
if (len==null)
{
if (theradio.checked==true)
{
return theradio.value;
}
}
else{
var ii=0;
for (i=0;i<len;i++)
{
if (theradio[i].checked)
return theradio[i].value;
}
}
}
else
{
return false;
}
return true;
}
javascript捕获异常
页面上有个iframe,如果调用iframe的方法是,iframe还没加载完成,
会报错误,用下面的方法可以解决这个问题。
var dataList="";
try{
//调用 iframe 的方法
dataList=document.frames("commitdata").getConfirmData();
}
catch(e)
{
spAlert("页面加载中,请稍后再进行操作");
return;
}