Current location: Hot Scripts Forums » General Web Coding » JavaScript » how to link a buttom to a script (show div) in another page??


how to link a buttom to a script (show div) in another page??

Reply
  #1 (permalink)  
Old 01-05-09, 08:10 AM
marianne fawzi marianne fawzi is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
how to link a buttom to a script (show div) in another page??

hi all
i neeed to link a(read more) buttom in a php page to a div in another php page which use (show and hide )javascript as follow but i wanted that admin to be dispaly when i click on read more and show it details:
HTML Code:
<div id="attach1_show" style="cursor:pointer; display:block"  onclick="Effect.SlideDown('admin'); this.style.display='none'; document.getElementById('attach1_hide').style.display='block';">Mr. Nasser</div>

<div id="attach1_hide" style="cursor:pointer; display:none"  onclick="Effect.SlideUp('admin'); this.style.display='none'; document.getElementById('attach1_show').style.display='block';">Mr. Nasser</div> 

<div style='display:none' id='admin'>***here put the block you want it to appear or hide***</div>
which means that the page which have javascipt work show details or hide details but if click on read more in another place so it shows the admin and display it without need to click on show details buttom

Last edited by TwoD; 01-16-09 at 05:03 PM. Reason: HTML wrapper
Reply With Quote
  #2 (permalink)  
Old 01-05-09, 08:20 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Is the other php page in new window or iframe?
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #3 (permalink)  
Old 01-08-09, 03:24 AM
marianne fawzi marianne fawzi is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
neither one of the two are php but i think i need to transform them to php but dont know how that make when i click on buttom in a page open another javascript shown text in another page so do u have a link to php of one of the two sript
thanks yeroon for ur help
Reply With Quote
  #4 (permalink)  
Old 01-08-09, 09:53 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Lets say this is the PHP page that has the "admin" div.

I'll call it "info.php".

PHP Code:

<script>
function show_hide(v)
{
 document.getElementById(v).style.display=document.getElementById(v).style.display=="block"?"none":"block";
 }
</script>
<?php
$display
=empty($_GET["display"])?"none":$_GET["display"];
?>
<div style="cursor:pointer;" onclick="show_hide('admin');">Mr. Nasser</div>
<div style="display:<?php echo $display ?>;" id="admin">***here put the block you want it to appear or hide***</div>
Then on the other page you would use a link like this:
HTML Code:
<style>
.info
{
 text-decoration:none;
 border:1px solid #000;
 padding-left:5px;
 padding-right:5px;
 background:#f6eeb3;
 }
</style>
<a href="info.php?display=block" class="info">read more</a>
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PTC Script Lanshire Job Offers & Assistance 2 11-20-08 02:18 PM
Free Link Exchange w/ Google Page Ranks ajs5mz2 Traffic Exchange 6 05-26-07 01:53 AM
link to my page script? BartAfterDark Script Requests 0 05-14-05 07:55 AM
Directing link to password protected page brb PHP 2 06-15-04 04:10 AM
How do I show a row per page? tbig ASP 2 02-12-04 04:19 PM


All times are GMT -5. The time now is 11:45 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.