0

i have the following code:

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 <script  type="text/javascript">
        function goToSignup() {
            $("#register").fadeIn("fast");
            $("#login").fadeOut("fast");
        }
        function goToLogin() {
            $("#login").fadeIn("fast");
            $("#register").fadeOut("fast");
        }                        
    </script>

that's my asp code:

   <div id="login" class="animate form">

       <h1>Log in</h1> 
      <p> 
          <label for="username" class="uname" data-icon="u" > Your username </label>
          <asp:Textbox runat="server" id="username"  name="username" type="text" placeholder="myusername"/>
     </p>
     <p> 
     <label for="password" class="youpasswd" data-icon="p"> Your password </label>
     <asp:Textbox runat="server" id="password"  name="password" type="password" placeholder="eg. X8df!90EO" /> 
     </p>
     <p class="keeplogin"> 
<input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" /> 
<label for="loginkeeping">Keep me logged in</label>
   </p>

   </div>

   <div id="register" class="animate form" >
    <h1> Sign up </h1> 
     <p> 
       <label for="usernamesignup" class="uname" data-icon="u">Firstname</label>
      <label for="usernamesignup" class="uname"  style="color: red;">*</label>
         <asp:CustomValidator ID="CustomValidator2" runat="server" Display="Dynamic"
        ValidationGroup="registerGRP" Font-Bold="true" ForeColor="Red" onservervalidate="cusCustom_RegisterValidate"></asp:CustomValidator>
      <asp:Textbox runat="server" id="Firstname" name="usernamesignup" type="text" placeholder="mysuperusername690" />
        </p>
      <p> 
     <label for="usernamesignup" class="uname" data-icon="u">Lastname</label>
     <label for="usernamesignup" class="uname"  style="color: red;">*</label>
      <asp:Textbox runat="server" id="Lastname" name="usernamesignup" type="text" placeholder="mysuperusername690" />
      </p>
       <p> 
       </div>

that's my vb.net code:

    Protected Sub btn_login_Click(sender As Object, e As System.EventArgs) Handles btn_login.Click
    If Session("valid") Then
        ScriptManager.RegisterStartupScript(Me.Page, Me.[GetType](), "foo", "goToLogin()", True)
    End If
End Sub

Protected Sub btn_signup_Click(sender As Object, e As System.EventArgs) Handles btn_signup.Click
    'Dim tbUserName As TextBox = Page.FindControl("username")
    'tbUserName.required = False
    ScriptManager.RegisterStartupScript(Me.Page, Me.[GetType](), "foo", "goToSignup()", True)
End Sub

when i click on the button the div fades out but the other div does not fade in when i inspect my page i get the container but it's invisible in the page

any suggestions?

4

1 回答 1

0

检查你的css中是否设置了

visibility:hidden;

对于您的一个面板。因为淡入淡出工作

display:none;

这里有一个解决方法:

   function goToSignup() {
        $('#register').css('visibility','visible').hide().fadeIn('fast');            
        $("#login").fadeOut("fast");
    }
    function goToLogin() {
        $('#login').css('visibility','visible').hide().fadeIn('fast');            
        $("#register").fadeOut("fast");
    } 
于 2013-09-20T15:07:37.213 回答