日期:2014-05-17  浏览次数:20452 次

如何用js控制html的输出,急啊~~~
利用radio值的改变而输出不同的html
例如一个form,简单如下:有两个按钮:学生     老师
当选中学生时,不显示职称,
选中老师时显示职称,而且显示位置不能改变。

<form   name= "form1 "   action= " "   method= "post ">
学生 <input   type= "radio "   name=“rad”   value= "0 ">
老师 <input   type= "radio "   name=“rad”   value= "1 ">
职称 <input   type= "text "   name=“zhicheng”>
.....
</form>



------解决方案--------------------
<DIV id= "divid "> 职称 <input type= "text " name=“zhicheng”> </div>
然后控制DIV 的显示和隐藏就可以了

------解决方案--------------------
<form name= "form1 " action= " " method= "post ">
学生 <input type= "radio " name= "rad " value= "0 " onclick= "document.getElementById( 'zc ').style.display= ' ' ">
老师 <input type= "radio " name= "rad " value= "1 " onclick= "document.getElementById( 'zc ').style.display= 'none ' ">
<div id= "zc "> 职称 <input type= "text " name=“zhicheng”> </div>
</form>
------解决方案--------------------
ls的写反了