Search Results

Search found 1 results on 1 pages for 'radiantjoy'.

Page 1/1 | 1 

  • Using Javascript to expand DIVs and go to anchor text

    - by radiantjoy
    I apologize that this question is so similar to "How can you check for a #hash in a URL using JavaScript?" but would appreciate your help with the following. I would like to use Javascript to display text that is a) identified by an anchor. b) contained within 2 collapsed DIVs....ONLY WHEN the anchor is in the URL. Otherwise, the page should display with all DIVs collapsed. Something like this: if (theHashIsABC) { Expand 2 DIVs on the page and go to the anchor; } else { just display the page; } Specifics: 1. Using IE7 2. DIVs ids to be expanded '8589' and '6212' out of several DIVs on the page 3. Anchor name is anchorABC I have been told that it is not possible to expand some DIVs in IE7 so I am thinking I need to expand all DIVs on the page. [ I can expand just the 2 with a link within the page: <a class="jumplink" href="javascript:toggleBlock('6212');toggleBlock('8589')";link to expand DIVs</a> ] This is what I have so far (in head section)... if(window.location.hash = "anchorABC") { //this works with a button on the page that expand all divs function showAll(pstrClass) { var aElts = document.getElementsByTagName('div'); setDisplay(pstrClass, aElts, 'show', 'Block'); aElts = document.getElementsByTagName('span'); setDisplay(pstrClass, aElts, 'show', 'Inline'); //would also like the page to move to the anchor } else { // just display the page } In advance, thank you for your time.

    Read the article

1