...

View Full Version : show hide div



eric float
08-29-2010, 01:49 PM
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

Fou-Lu
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.

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

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

codebyter
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
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';
}
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum