返回首页

您好,

我有一个Web表单,其中包含两个单选按钮组
NBSP
;第一组包含两个单选按钮类,如:。开放,并保留
BR}第二组包含SC,ST,OBC,单选
NBSP等;
的条件是,如果我开放单选按钮RadioButton的第二组应该得到选中
NBSP。

的 ?
请帮。

回答

评论会员:yogesh89 时间:2012/02/07
我的解决方案


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

<html>

<head>

  <title>Untitled</title>

<script type="text/Javascript">

// Enforce Yes/No fields in eval form

function uncheck_yesno(obj)

{

  if (!obj)

  {

    alert(obj + ' does not exist');

    return false;

  }

  

  for (var i=0; i < obj.length; i++)

  obj[i].checked = false;

}

 

function check_yesno(obj)

{

  if (!obj)

  {

    alert(obj + ' does not exist');

    return false;

  }

  

  for (var i=0; i < obj.length; i++)

  {

    if (obj[i].value==1)

    {

      obj[i].checked = true;

    }

  }

}

</script>

</head>

<body>

 

<form action="" name="eval_form" method="POST">

<table border="0" width="100%" cellspacing="2" cellpadding="3">

  <tr class="table-head" align="center">

    <td></td>

    <td></td>

    <td>1</td>

    <td>2</td>

    <td>3</td>

    <td>4</td>

    <td>5</td>

    <td>6</td>

    <td>7</td>

    <td>8</td>

    <td>9</td>

    <td>10</td>

  </tr>

  <tbody class="table-body">

  <tr class="alt1" align="center">

    <td>Lack of Exercise</td>

    <td>

      Yes: <input type="radio" name="lack_exercise" value="1"  枚nclick="check_yesno(document.eval_form.lack_exercise_r)">

      No: <input type="radio" name="lack_exercise" value="0" checked="yes"  枚nclick="uncheck_yesno(document.eval_form.lack_exercise_r)">

    </td>

    <td><input type="radio" name="lack_exercise_r" value="1"  枚nclick="alert(this.name)"></td>

    <td><input type="radio" name="lack_exercise_r" value="2"></td>

    <td><input type="radio" name="lack_exercise_r" value="3"></td>

    <td><input type="radio" name="lack_exercise_r" value="4"></td>

    <td><input type="radio" name="lack_exercise_r" value="5"></td>

    <td><input type="radio" name="lack_exercise_r" value="6"></td>

    <td><input type="radio" name="lack_exercise_r" value="7"></td>

    <td><input type="radio" name="lack_exercise_r" value="8"></td>

    <td><input type="radio" name="lack_exercise_r" value="9"></td>

    <td><input type="radio" name="lack_exercise_r" value="10"></td>

    

  </tr>

</tbody></table>

</form>

 



</body>

</html>

评论会员:游客 时间:2012/02/07
马库斯・克雷默:你描述的仅仅是一个错误的用户界面设计的迹象。甚至为最终用户,它可能是反直观的。也许你没有定义组正确,或应使用一些不同的UI设计理念。mdash;SA
SAKryukov下
评论会员:游客 时间:2012/02/07
{C}试试上面的代码。的逻辑是存在的,只是探索。请注明这是正确的,如果它固定您的问题。最好的问候,爱德华:爱德华・卢:你不必调用模态弹出,因为您填写的目标控制希望它帮助