开发者

Prototype and radio buttons

I have two sets of radios:

<div class="form-row">
    <div class="field-label">
        <label for="part"><span class="style37">Participated</span></label><p class="aste">*</p>
           开发者_C百科 <input type="radio" name="particip" id="particip-yes" value="on" checked> Yes
            <input type="radio" name="particip" id="particip-no" value="off">No
     </div>
 </div>
 <div class="form-row">
     <div class="field-label">
         <label for="trav"><span class="style37">Traveled?:</span></label>
             <input type="radio" name="traveled" id="traveled-yes" value="on" checked>Yes
             <input type="radio" name="traveled" id="traveled-no" value="off">No
     </div>
  </div>

When I click on particip-no, I need to select traveled-no and disable both travel-yes and travel no. I tried:

  Event.observe('particip-no', 'click', function() {
      $$('travel-no').checked=true
      $$('travel-no').disabled=true
      $$('travel-si').disabled=true
      alert('no travel');});

The alert shows up, but there are no changes in the radios. Any hints ? Thanks.


If you're selecting by id you just want $ not $$

  $('travel-no').checked=true;
  $('travel-no').disabled=true;
  $('travel-si').disabled=true;

...assuming the id's are correct. You're missing the semicolons too btw

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜