当前位置:嗨网首页>书籍在线阅读

13-问题

  
选择背景色: 黄橙 洋红 淡粉 水蓝 草绿 白色 选择字体: 宋体 黑体 微软雅黑 楷体 选择字体大小: 恢复默认

10.3.1 问题

你有一系列单选钮。最后一个按钮的标签为“Other”并关联一个文本输入字段。很自然,你希望如果用户在Other字段中输入文本时选中该按钮:

<p>How did you hear about us?</p>
<ul id="chooseSource">
   <li>
     <input name="source" id="source1" type="radio" value="www" />
     <label for="source1">Website or Blog</label>
   </li>
   <li>
     <input name="source" id="source2" type="radio" value="mag" />
     <label for="source2">Magazine</label>
   </li>
   <li>
     <input name="source" id="source3" type="radio" value="per" />
     <label for="source3">Friend</label>
   </li>
   <li>
     <input name="source" id="source4" type="radio" value="oth" />
     <label for="source4">Other</label>
     <input name="source4txt" id="source4txt" type="text" />
   </li>
</ul>