2015-03-08 3 views
0

У меня есть две формы в одной странице,
Я хочу, чтобы скрыть класс = «регистр» форма OnClick «Func (1)» и показать класс = "знак " вид, используя сценарий java.
И onclick "func (2)" hide class = "sign" Форма и вид class = "register" Форма.OnClick скрыть событие и показать 2 формы с помощью JavaScript

<form method="post" action="agent.php" id="register_form" class="register" style="display:block;" name="form1" >      
       <h2>Sign-up </h2> 
       <input type="text" id="name" name="agent_name" placeholder="Agent Name.."/> 
       <input type="text" id="mail" name="agent_email" placeholder="E-Mail.." /> 
       <input type="text" id="password" name="agent_password" placeholder="Password.." /> 
       <input type="text" id="number" name="agent_mobile" placeholder="Mobile...." /> 
       <br><br><br><br><br><br><br><br><br> 


        <select class="form-control sele" name="agent_state" id="country" for="u_state" style="background: rgb(235,235,235);" onChange="getCity('findcity.php?country='+this.value)"> 
         <option value="" selected class="below">Choose state from below...</option> 
          <?php 
           while($row = mysql_fetch_array($result)) 
           { 
            $State = $row['state']; 
            $StateID = $row['state_id'];           
            echo "<option value=". $StateID ." cna=".$State.">" . $State ."</option>"; 
           } 
          ?> 
        </select> 

       <br> 
       <div id="citydiv"> 
        <select class="form-control sele" name="agent_location" for="u_city" style="background: rgb(235,235,235);"> 
         <option value="" selected class="below">Choose Location from below...</option> 
        </select> 
       </div> 


       <!-- Agree with the term of services --> 
       <input type="checkbox" id="tos" name="tos" /> 
       <label for="tos">Accept the <a href="">Terms of service</a></label> 
       <!--<input type="checkbox" id="news" name="news"> 
       <label for="news">Subscribe to our newsltetter !</label>--> 

       <!-- // // // // // // // // // // -->      
       <input type="submit" id="" name="reg_agent" value="Register" /> 
       <input type="submit" id="sign2" value="Already A Member ? Sign_In" onclick="func(1)"/> 

       </form> 


     <!--//////// AGENT SIGN IN FORM ///////////--> 


      <div> 
       <form method="post" action="#" id="signin_form" class="sign" style="display:none;" name="form1" id=""> 
       <h2>Sign-In </h2> 
       <input type="text" id="name" name="name" placeholder="Agent Name/E-Mail_Id"/> 
       <input type="text" id="password" name="password" placeholder="Password.." /> 
       <!-- Agree with the term of services --> 
       <input type="checkbox" id="tos" name="tos" /> 
       <label for="tos">Remember Me</label> 
       <!--<input type="checkbox" id="news" name="news"> 
       <label for="news">Subscribe to our newsltetter !</label>--> 

       <!-- // // // // // // // // // // -->  
       <input type="submit" id="" value="Sign_In" onclick="window.location.href = 'agent_profile.php' " /> 
       <input type="submit" id="register2" value="Not A Member.... Register" onclick="func(2)"/> 

       <div> 
        <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> 
       </div> 
       </form> 
      </div> 

ответ

0

Try скрыть и показать,

function func(para) 
{ 
if(para==1) 
{ 
$(".sign").show(); 
$(".register").hide(); 
} 
else if(para==2) 
{ 
$(".sign").hide(); 
$(".register").show(); 
} 

} 
+0

Не работает Вишну. onclick func (1) страница перезагружается снова –

+0

положить кнопки ввода из – Vishnu

+0

спасибо Вишну, он работает. –

Смежные вопросы