Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:22:48+00:00 2026-05-26T03:22:48+00:00

I have this content box on my site, that has different tabs on the

  • 0

I have this content box on my site, that has different tabs on the side and when you click on one of the tabs, it uses JS to hide/show the according divs inside the content box.

I also have this in my head to give each div inside the content box it’s own URL:

<script type="text/javascript">
  function loadSmugInfo() {
    if(window.location.hash == '#smuginfo')
      document.getElementById('contentInfo').style.display = "block";
      document.getElementById('contentSlideshow').style.display = "none"
  }
</script>

<script type="text/javascript">
  function loadFind() {
    if(window.location.hash == '#find')
      document.getElementById('contentMap').style.display = "block";
      document.getElementById('contentSlideshow').style.display = "none"
  }
</script>

<script type="text/javascript">
  function loadSmugmug() {
    if(window.location.hash == '#smugmug')
      document.getElementById('contentSmugInfo').style.display = "block";
      document.getElementById('contentSlideshow').style.display = "none"
  }
</script>

<script type="text/javascript">
  function loadMain() {
    if(window.location.hash == '#')
      document.getElementById('contentSlideshow').style.display = "block"
  }
</script>

<script type="text/javascript">
  function loadSlideshow() {
    if(window.location.hash == '#slideshow')
      document.getElementById('contentSlideshow').style.display = "block"
  }
</script>

I also have it so when you a click a tab, it changes the hash.

Here is my problem.
When the page loads like normal (without a hash), the first and topmost div, is still not displaying (even though it’s set to display: block in CSS).

I’m loading the functions you see above, using onLoad on an image above the content box.

Any help would be appreciated, I’m on a little bit of a tight schedule.
Let me know if you need any more information.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:22:48+00:00Added an answer on May 26, 2026 at 3:22 am

    If you’re doing what I understood you’re doing, you’d have to use

    if( (window.location.hash == '#') || (window.location.hash == '')
    

    instead of

    if(window.location.hash == '#')
    

    since the hash is empty when the script is loading.

    On a side note:

    You only need one function for all of this:

    function whatever()
    {
        if(window.location.hash == '#smuginfo')
        {
            case1
        }
        else if(window.location.hash == '#find')
        {
            case2
        }
        .
        .
        .
        else
        {
            default for no hash
        }
    }
    

    It would be shorter with a switch statement…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this content script that downloads some binary data using XHR, which is
I have this menu structure that is used to navigate through content slider panels.
I have this method in App Delegate that makes a window and content view
I have a Drupal setup like this: Content type: Apartments Vocabulary: Areas , that
I have a site that is Ajaxed, content that is Ajax is from other
I've got a Django site that has a sidebar with a variety of different
I have a site with a search box that works fine in all browsers
I have a web site that uses Microsoft Indexing Service to index and query
I have a site design that uses background images and textures as a feature
I have a mobile site that includes a search box at the bottom. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.