
function showDIV(){
if(document.getElementsByName("r")[0].checked){
document.getElementById("div1").style.display=""
document.getElementById("div2").style.display="none"
}else{
document.getElementById("div1").style.display="none"
document.getElementById("div2").style.display=""
}
}
首先添加给radio添加绑定单击事件,可以直接使用onclick="",也可以用jquery绑定;
$(function() {
showCont()
$("input[name=price_type]").click(function() {
showCont()
})
})
function showCont(){
var normal = document.getElementById("price_type1")
var special = document.getElementById("price_type2")
if (normal.checked) {
$("#sellInfo2").hide()
$("#sellInfo1").show()
}
if (special.checked) {
$("#sellInfo1").hide()
$("#sellInfo2").show()
}
}
结果:
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)