drcx71276 2016-06-25 11:12
浏览 14
已采纳

表单打开onclick按钮

I have a form. In which I have fields SCHOLARSHIP FORM, PAYMENT, REGISTRATION NO. and ADMIT CARD. If i click on SCHOLARSHIP FORM, its fieldset should be open. If I click PAYMENT, its fieldset should be replace existing and payment's fieldset should be open inplace of existing.

It is opening, but below old one. It is not replacing.

        <form id="msform">
         <!-- progressbar -->
          <ul id="progressbar">
          <li class="active"><a href = "#" onclick = "showForm1()">Scholarship Form</a></li>
           <li class="active"><a href = "#" onclick = "showForm()">Paymen</a>t</li>
           <li class="active">Registration No.</li>
       <li class="active">Admit Card</li>
     </ul>
     <!-- fieldsets -->
       <fieldset id = "theform1" style="display:none">
      <h2 class="fs-title">Scholarship Form</h2>
      <h3 class="fs-subtitle">Fill Your Details</h3>
        <input type="text" name="email" placeholder="Email" />
       <input type="password" name="pass" placeholder="Password" />
       <input type="password" name="cpass" placeholder="Confirm Password" />

      </fieldset>
        <script type = "text/javascript">
       function showForm1() {
        document.getElementById("theform1").style.display = "block";
      }
      </script>



       <fieldset id = "theform" style="display:none">
        <h2 class="fs-title">Payment</h2>
        <h3 class="fs-subtitle">Pay scholarship fee</h3>
          <input type="text" name="twitter" placeholder="Twitter" />
          <input type="text" name="facebook" placeholder="Facebook" />
          <input type="text" name="gplus" placeholder="Google Plus" />

       </fieldset>
       <script type = "text/javascript">
         function showForm() {
            document.getElementById("theform").style.display = "block";
       }
          </script>





         <fieldset>
       <h2 class="fs-title">Registration Number</h2>
       <h3 class="fs-subtitle">Download or Print your Registration Number</h3>
         <input type="text" name="fname" placeholder="First Name" />
        <input type="text" name="lname" placeholder="Last Name" />
          <input type="text" name="phone" placeholder="Phone" />
             <textarea name="address" placeholder="Address"></textarea>

       </fieldset>




        <fieldset>
     <h2 class="fs-title">Admit Card</h2>
          <h3 class="fs-subtitle">Download or Print Your Admit Card</h3>

                <input type="text" name="phone" placeholder="Phone" />
                  <textarea name="address" placeholder="Address"></textarea>

           </fieldset>
    </form>
  • 写回答

2条回答 默认 最新

  • dongqucheng3851 2016-06-25 11:20
    关注

    Sounds like you need to hide any open form first.

    function showForm1() {
        document.getElementById("theform1").style.display = "block";
        document.getElementById("theform").style.display = "none";
    }
    

    If you do this for both forms you should be all set.

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

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R