How to use div

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rohitvshinde
    New Member
    • Feb 2009
    • 5

    How to use div

    Hi everybody,
    In my web page i have a EDIT button, when the user click on the edit button,
    I want to display a small window in which I want to enter the details which are to be edited.
    How could it be possible?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    -- Moved from PHP.

    PHP will not help you show a div. Anyway, is your data coming from a database?

    Comment

    • rohitvshinde
      New Member
      • Feb 2009
      • 5

      #3
      Hi markus, thanx for replaying.
      No my data is not coming from database, and ok if php dont have div, so can I use another coding in my php page for div.
      ACTUALLY MARKUS,
      when we click on the login hyperlink on this website, then a small window is generated, which asks us username and password.
      thats all I want to do some thing like that.
      please help me.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You can put the div within the page and keep it hidden:
        Code:
        <div id="login" style="display:none">
        then when it's ready to be shown:
        Code:
        document.getElementById("login").style.display = "block";

        Comment

        • rohitvshinde
          New Member
          • Feb 2009
          • 5

          #5
          thanx,
          have u got what m I want to display?
          Just look at the small window came when we click on the login hyperlink on this website only.
          And if do you have a code for it please send me.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            The code is simple enough. View the source to see it:
            Code:
            <div style="display: none;" id="login_menu"> some content </div>
            where "some content" is the HTML for the login form.

            Now, you need a trigger to show this hidden div. Either use a link or a button. In the onclick, call a function to show the div. You could use a general function:
            Code:
            function showDiv(id) {
                document.getElementById(id).style.display = "block";
            }
            which is called as follows:
            Code:
            <input type="button" id="showLogin" value="Login" onclick="showDiv('login_menu');">

            Comment

            Working...