怎么在同一个JSP页面中调用 radio选中的值
如何在同一个JSP页面中调用 radio选中的值
新人求教:我在JSP页面写了一个radio,代码如下
<c:forEach items="${product.styles}" var="style">
<li><label class="radio">
<input type="radio" name="styleid" id="styleid" value="${style.id }" >
<i></i>${style.name}</label></li>
</c:forEach>
在本页中有一个文本输入框,我想用上面radio选中的值给文本输入框定义name,代码类似如下:
<input type="text" name="amount_radio选中值" />
我想请教一下在文本输入框中name的属性如何调用radio选中的值? 希望能有代码说明。在线等待中!谢谢!
------解决思路----------------------
<html>
<head></head>
<body>
<input type="text" id="text1" name="text1" value="" oninput="OnInput()" onpropertychange="OnPropChanged()"/>
<input type="text" id="text2" name="text2" value="" />
</body>
<script type="text/javascript">
// Firefox, Google Chrome, Opera, Safari, Internet Explorer from version 9
function OnInput () {
document.getElementById("text2").value = document.getElementById("text1").value;
}
// Internet Explorer
function OnPropChanged () {
document.getElementById("text2").value = document.getElementById("text1").value;
}
</script>
</html>
新人求教:我在JSP页面写了一个radio,代码如下
<c:forEach items="${product.styles}" var="style">
<li><label class="radio">
<input type="radio" name="styleid" id="styleid" value="${style.id }" >
<i></i>${style.name}</label></li>
</c:forEach>
在本页中有一个文本输入框,我想用上面radio选中的值给文本输入框定义name,代码类似如下:
<input type="text" name="amount_radio选中值" />
我想请教一下在文本输入框中name的属性如何调用radio选中的值? 希望能有代码说明。在线等待中!谢谢!
------解决思路----------------------
<html>
<head></head>
<body>
<input type="text" id="text1" name="text1" value="" oninput="OnInput()" onpropertychange="OnPropChanged()"/>
<input type="text" id="text2" name="text2" value="" />
</body>
<script type="text/javascript">
// Firefox, Google Chrome, Opera, Safari, Internet Explorer from version 9
function OnInput () {
document.getElementById("text2").value = document.getElementById("text1").value;
}
// Internet Explorer
function OnPropChanged () {
document.getElementById("text2").value = document.getElementById("text1").value;
}
</script>
</html>