View Full Version : show hide div

eric float
08-29-2010, 01:49 PM
i have 3 link in top of page. now how to add div for each link after click .
Example :
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 ...............................


08-29-2010, 04:56 PM
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.

08-30-2010, 10:44 PM
External? Possibly something like:

<style type="text/css">
position: absolute;

<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;
<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>

08-31-2010, 08:05 PM
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:

function toggle_div(id){
//get the object u want to toggle
var e = document.getElementById(id);

//check for the element u want to toggle
//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
//turn the object off
e.style.display = 'none';