载心问情 2012-09-13 19:38 采纳率: 100%
浏览 517
已采纳

JSP中Form表单reset出现一个问题

[code="jsp"]

function fun_one() { document.newForm.one.style.display = ""; document.newForm.two.style.display = "none"; } function fun_two() { document.newForm.one.style.display = "none"; document.newForm.two.style.display = ""; } Input One Input Two
InputOne
InputTwo
 

[/code]

我的想法是用radio来控制表单里的元素,当点击Input One时,下面InputOne的文本框就会显示出来,而InputTwo就会隐藏;反之,点击Input Two也会有这样的效果。但是当我先点击了Input Two时,这时InputOne的文本框隐藏,InputTwo显示,这时还是正常情况,如果我接着点击reset,重新填写时,由于Input One默认被选中,理想的情况是InputOne重新显示,InputTwo隐藏,可是实际情况是Input One是被选中状态,而InputOne隐藏,InputTwo显示。
这个问题很奇怪,不知道我是否描述清楚,有人知道是哪里出的问题吗,清指点,谢谢!

  • 写回答

2条回答

  • jinnianshilongnian 2012-09-13 20:15
    关注

    [code="java"]<br> function fun_one() {<br> document.getElementById(&quot;one&quot;).style.display = &quot;&quot;;<br> document.getElementById(&quot;two&quot;).style.display = &quot;none&quot;;<br> }<br> function fun_two() {<br> document.getElementById(&quot;one&quot;).style.display = &quot;none&quot;;<br> document.getElementById(&quot;two&quot;).style.display = &quot;&quot;;<br> }<br>

    Input One Input Two
    InputOne
    InputTwo
     

    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题