SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Dec 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:
    (<div id="attach1_show" style="cursorointer; display:block" onclick="Effect.SlideDown('admin'); this.style.display='none'; document.getElementById('attach1_hide').style.disp lay='block';">Mr. Nasser</div>

    <div id="attach1_hide" style="cursorointer; display:none" onclick="Effect.SlideUp('admin'); this.style.display='none'; document.getElementById('attach1_show').style.disp lay='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

  2. #2
    SitePoint Addict aguroyz's Avatar
    Join Date
    Jan 2009
    Location
    Konoha Fire Country
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow, that's interesting..

    Can't help you w/ that though, but please share if you find a way... tnx
    Uniquely FILIPINO... See how talented and creative Filipinos are.
    http://www.smalltym.com
    Custom Web Designs:
    http://proweaver.com

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    Romania, Iasi
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cookies and continous checking them or using ajax (same principle, different wrappers)

  4. #4
    SitePoint Addict
    Join Date
    Aug 2007
    Location
    St. Louis, MO.
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got something similar that I've been asked to do so I've been thinking about it for a little. The button will carry with it a post or get request either will work. I'll call it divStatus = show.

    On the page with the div put in a hidden field somewhere.

    Code HTML4Strict:
    <input type="hidden" name="divStatus" value="<?=$_REQUEST['divStatus']?>" />

    On the top of that page after you call jquery's doc ready search for that value and display accordingling.

    Code JavaScript:
     
     var divStatus = $(':input').val();
     
     if divStatus != show {
      // div hide
     }

    ... heh using a variable of of show for divStatus is a bad idea but you get the point.


Bookmarks

Posting Permissions

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