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 div

  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    show hide div

    Hi,
    i have 3 link in top of page. now how to add div for each link after click .
    Example :
    LINK 1 | LINK2 |LINK3
    When Click Link 1 Open Div and Show Loading Message . . . . . ( comment form using Php include or External page ) and after send comment close(hide) Div Automatic.
    When Click Link 2 Open Div and Show Loading Message . . . . . ( tell friends form using Php include or External page ) and after send tell friends close(hide) Div Automatic.
    Link3 ...............................

    Thanks

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This sounds like Javascript to me, let me know if your intention for use is actually Java and I'll move it back to the java forum.
    From what you have here, you will need AJAX to retrieve the external information from PHP. Moving to the AJAX forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    366
    Thanks
    9
    Thanked 53 Times in 52 Posts
    External? Possibly something like:
    Code:
    <html>
    <head>
    <style type="text/css">
      .myframe{
        position: absolute;
      }
    </style>
    
    <script type="text/javascript">
      var myframe = document.createElement("iframe");
      myframe.src = "http://www.google.com";
      myframe.className = "myframe";
      myframe.name = "myframe";
    
      function my_click(url){ 
        myframe.src = url;
        document.body.appendChild(myframe);
      }
    </script>
    </head>
    <body>
      <a href="comment_form.html" target="myframe" onclick="my_click('comment_form.html')"/>comment</a>
      <a href="tell_form.html" target="myframe" onclick="my_click('tell_form.html')"/>tell</a>
    </body>
    </html>

  • #4
    New Coder
    Join Date
    Aug 2010
    Location
    FL
    Posts
    35
    Thanks
    0
    Thanked 1 Time in 1 Post
    ugh, no iframes! you could actually inject the form with javascript and have it post data etc using ajax.

    in reference to toggling certain divs:

    Code:
    function toggle_div(id){
    	//get the object u want to toggle
    	var e = document.getElementById(id);
    
    	//check for the element u want to toggle
    	if(e){
    		//check the display status of the object
    		if(e.style.display === 'none'){
    			//turn the object back on
    			e.style.display = 'block';
    		}
    		//else the object is showing, turn it off
    		else{
    			//turn the object off
    			e.style.display = 'none';
    		}
    	}
    }


  •  

    Posting Permissions

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