It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

how to make show/hide page

how to make show/hide page

Postby dunk6 on Thu Nov 12, 2009 9:04 am

Hi all,

i have to php pages. View.php and comment.php. Write now, at view.php will there will be link to call for comment.php page and the window will pop up. comment.php only contain a html editor and send button. after user click, it will closed the windows.

instead of doing pop up, i want to make the link to be able to show/hide this comment. So how can i do this?

thank you very much.
dunk6
 
Posts: 1
Joined: Thu Nov 05, 2009 2:07 am

Re: how to make show/hide page

Postby flabbyrabbit on Thu Nov 12, 2009 11:11 am

Well the easiest way to do this would to have a div containing the comment form. This div will need to look something like:
Code: Select all
<div id="comment" style="display: none">
<!-- Code for comment form -->
</div>

You will also need the javascript code:
Code: Select all
comment_state = 'none';
function show_comment() {
if (comment_state == 'block') {
   comment_state = 'none';
} else {
   comment_state = 'block';
}
document.getElementById('comment').style.display = comment_state;
return false;
}

and finally the link
Code: Select all
<a href="#" onclick="javascript:show_comment();">Show Offline Friends</a>


Hope that helps,
Flabby Rabbit
Image
User avatar
flabbyrabbit
500+ Club
 
Posts: 706
Joined: Thu Jan 25, 2007 1:10 pm
Location: Midlands, England


Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests