Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    2
    Member #
    27879
    Okay I know how to show/hide a div with links within that page that the div is in and those links are functioning fine. I need help how ever showing that div using a link from another page.

    This is what I want

    I have a guestbook in which their is a hidden div that when someone clicks "sign guestbook" that div shows up with the form.

    What I would like to have is. I have two links on my home page a "view guestbook" link which just brings you to the guestbook page without showing the div with the form in it and another link that says "sign guestbook" and I would like that if I click this link it brings the person to the guestbook page and shows the div with the form inside it. So that people can go directly to the sign guestbook form right from the home page. How would I do this?

    The id of the hidden div is "sign"

    please explain it very well as I have no idea how to do this.

  2.  

  3. #2
    Junior Member
    Join Date
    May 2011
    Posts
    14
    Member #
    27825
    Liked
    8 times
    Hi Pat, could you post the code you are using to toggle the visibility on the hidden div?

  4. #3
    Junior Member
    Join Date
    May 2011
    Posts
    2
    Member #
    27879
    Yeah sorry about that.

    here's the Javascript:

    Code:
    <script language=javascript type='text/javascript'>
    function showdiv() {
    if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById('sign').style.display = 'block';
    }
    else {
    if (document.layers) { // Netscape 4
    document.sign.visibility = 'visible';
    }
    else { // IE 4
    document.all.sign.style.display = 'block';
    }
    }
    }
    
    function hidediv() {
    if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById('sign').style.display = 'none';
    }
    else {
    if (document.layers) { // Netscape 4
    document.sign.visibility = 'hidden';
    }
    else { // IE 4
    document.all.sign.style.display = 'none';
    }
    }
    }
    </script>
    if you need any other code just let me know.

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    If you want to toggle visibility of a div, you're better off doing it this way. I'm not bothering with NS4 or IE4 because they've long since fallen off the face of the earth.
    Code:
    function toggleDiv() {
         var sign = document.getElementById('sign');
         if (sign.style.display = 'block') {
              sign.style.display = 'none';
         } else {
              sign.style.display = 'block';
         }
    }
    ...
    Code:
    <a href="whatever-you're-going-to-use-to-open-the-guestbook" onclick="toggleDiv();" ondblclick="toggleDiv();">Link here</a>
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

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

Search tags for this page

link display hidden div on different page

,
show div of another page to another in javascript
,

show hide div from another page

Click on a term to search for related topics.
All times are GMT -6. The time now is 10:39 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com