下面form表单根据radio值去切换就可以了
首先先在页面中写两个表单,一个显示,一个隐藏。radio点击事件中再隐藏和展示表单
如果换jq 会好一点,js 有点原生
<div>
<input type='radio' name='sForm' onclick='fnClick(this)' id='f1'/>form1
<input type='radio' name='sForm' onclick='fnClick(this)'id='f2'/>form2
<form id='form_f1' >
<label>form1</label>
<input type='text'/>
</form>
<form id='form_f2' style='display: none'>
<label>form2</label>
<input type='text'/>
</form>
</div>
<script>
function fnClick(that){
if(that.checked === true){
document.getElementById('form_f1').style.display = 'form_f1' == 'form_'+ that.id ? null : 'none'
document.getElementById('form_f2').style.display = 'form_f2' == 'form_'+ that.id ? null : 'none'
}
}
</script>
你可以先写两个表单,用js改变form标签的css样式的display属性,选中普通登录的时候,普通登录这个表单的display属性就设置为block,手机动态密码登录这个表单的display属性就设置为none,选中手机动态密码登录的时候就反过来