Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Show/Hide Help

  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    United States
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Show/Hide Help

    Hey I have a show/hide script here that when I click a link it shows a login form. I made a picture to better explain what I want.



    What I want is the login form to be on the right side of the word login instead of under it. Here is my code:

    PHP Code:
    echo"<a href=\"register.php\">Register</a> || <a href=\"javascript:void(0);\" onClick=\"showHide('loginform')\";>Login</a> 

    <div class=\"hidden\" id=\"loginform\">

    <form action=\"account.php?function=login&url=$url\" method=\"post\">

    <input class=\"textfield\" type=\"text\" name=\"username\" maxlength=\"25\" size=\"15\"> 

    <input class=\"password\" type=\"password\" name=\"password\" maxlength=\"25\" size=\"15\" value=\"Password\"> 

    <input class=\"submit\" type=\"submit\" value=\"Login\">

    </form></div>"
    ;

    // I spaced it out so everyone can see fine, in actuality the code is bunched up 
    Someone please help

  • #2
    Regular Coder
    Join Date
    Mar 2005
    Location
    United States
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe I should have put this in the HTML section. My bad.

  • #3
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,513
    Thanks
    3
    Thanked 504 Times in 491 Posts
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--

    function 
    PosInput(){
     
    mi=document.getElementById('MyInput').style;
     
    ma=document.getElementById('fred');
     
    mi.top=zxcTop(ma)+'px';
     
    mi.left=zxcLeft(ma)+'px';
    }

    function 
    zxcLeft(zxc){
     
    zxcObjLeft=zxc.offsetLeft;
     while(
    zxc.offsetParent!=null){
      
    zxcObjParent=zxc.offsetParent;
      
    zxcObjLeft+=zxcObjParent.offsetLeft;
      
    zxc=zxcObjParent;
     }
     return 
    zxcObjLeft;
    }

    function 
    zxcTop(zxc){
     
    zxcObjTop=zxc.offsetTop;
     while(
    zxc.offsetParent!=null){
      
    zxcObjParent=zxc.offsetParent;
      
    zxcObjTop+=zxcObjParent.offsetTop;
      
    zxc=zxcObjParent;
     }
     return 
    zxcObjTop;
    }

    //-->
    </script></head>

    <body onload="PosInput" >
    Good Evening Anonymous register || Log In <a id="fred"></a>

    <div id=MyInput style="position:absolute;width:300px;height:10px;" >
    <input name="" size="10" value="User Name">
    <input name="" size="10" value="*********">
    <input type="button" name="" value="LogIn">
    </div>

    </body>

    </html> 

  • #4
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Allways follow the KISS principle:

    Use:

    document.getElementById("ID_OF_THE_ELEMENT").style.visibility="hidden"
    and
    document.getElementById("ID_OF_THE_ELEMENT").style.visibility="visible"

    Hope that helps.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •