Results 1 to 3 of 3

Thread: How do I anchor within a hidden div in a javascript toggle?

Hybrid View

  1. #1
    Join Date
    May 2011

    How do I anchor within a hidden div in a javascript toggle?

    I have created a page using collapsible divs through a simple javascript toggle. This is the javascript:

    <script language="javascript">
       function getItem(id)
            var itm = false;
                itm = document.getElementById(id);
            else if(document.all)
                itm = document.all[id];
            else if(document.layers)
                itm = document.layers[id];
            return itm;
    function toggleItem(id)
            itm = getItem(id);
                return false;
            if(itm.style.display == 'none')
                itm.style.display = '';
                itm.style.display = 'none';
            return false;
    And at the toggle bar, it uses:
    <a onclick="toggleItem('evn')">
    While the div is:
    <div id="evn" style="display:none;">
    This page is a class listing and each toggle bar is a class category. What I want to do is be able to link from another page to the class page, but to a specific class listing within the hidden div section.

    The actual page is: http://lifeatvictory.fhcaleb.com/connection.php

    Please note that I am working within the confines of a content management system.

    I need something like: go to the page, do the toggle function to show the div, then find a page anchor to locate the correct class.

    Iím not sure how to go about this. Any help is greatly appreciated! Thanks, thanks!!

  2. #2
    Join Date
    Dec 2003
    Bucharest, ROMANIA
    First: forget about that function getItem(id). All the browsers in use today use getElementById() method. And use type="text/javascript" instead of language="javascript". language is deprecated.

    As for the rest, I confess I don't understand which is your aim. "class category"? "class page"? "correct class"? What do you mean by all these? What do mean by "class"?

    Can you detail your aim, please? In plain and simple words.

  3. #3
    Join Date
    May 2011
    Hi Kor,

    Thanks for your help.

    This is a page on a church web site. The church offers many different classes throughout the year, which the congregation can take. Because there are so many, they are separated into categories, like "Spiritual Growth" or "Discipleship."

    Each category is a bar which, when clicked, displays all the available classes that fall under that category. ie - Click the Spiritual Growth bar and see all the Spiritual Growth classes. Each class listing has a description of the class and a link to register for it. Some of the classes, like the Membership class need to be able to be reached from another page like the "How to Become a Member" page. From the "How to Become a Member" page, I want a link that will go to the page of all the classes, open the category bar for "Discipleship", then go right to the description and registration for the Membership class (like a page anchor would), which is several classes down in the list.

    Does that clear it up? If you have a quick second to go to the page, it should be easier to see what I mean. http://lifeatvictory.fhcaleb.com/connection.php


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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