我正在尝试创建一个页面来初始化要使用的地理定位 API。此页面将有两个单选按钮,用于在选项之间切换。我这样创建了两个单选按钮:
<tr>
<td colspan="2">
<bean:message key="config.geolocation.page.text"/>
</td>
</tr>
<tr>
<td class="odd" width="20%" nowrap>
<bean:message key="editvarref.header.geolocation.pick.api"/>
</td>
<td class="odd" width="80%">
<div>
<html:radio styleId="logo_type_0" property="b_type" value="0" onclick="show_logo(false)" />
<label for="b_type_0"><bean:message key="geolocation.use.google"/></label>
</div>
<div style="padding-top:5px; padding-bottom:5px;">
<html:radio styleId="b_type_1" property="b_type" value="1" onclick="show_logo(true)" />
<label for="bo_type_1"><bean:message key="geolocation.use.skyhook"/></label>
</div>
</td>
</tr>
如何修改单选按钮以显示不同的输入字段,用户可以在其中输入值。我试图让两个单选按钮显示不同的输入字段。 So when one is chosen it will show certain fields and when the other is clicked it will show different fields.这些字段将是一个文本框,用户可以在其中输入信息
最佳答案
脚本
$(document).ready(function() {
$(".text").hide()
});
function getResults(elem) {
elem.checked && elem.value == "Show" ? $(".text").show() : $(".text").hide();
HTML
<input type="radio" name="radio1" value="Show" onClick="getResults(this)">
Do nothing
<input type="radio" name="radio1" value="Nothing" onclick="getResults(this)">
关于java - 使用 Struts 框架在 JSP 中输入表单的单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31349569/