12-23-2009, 01:40 AM
|
#2 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 287
Thanks: 5
|
> I would like to click on the first page's link and have it load the second page and open the corresponding accordion list.
I'm going to assume that the <a>'s are set up similar to this.
Code:
<a href="about.php#contact">Contact</a>
<a href="about.php#work">Our Projects</a>
javascript Code:
window.onload = function () { var hash = window.location.hash.substr(1);
// You grab the assoicated element with the hash gathered from // [url]http://domain.tld/about.php#contact[/url] // If you're going to assign multiple css properties then I would // suggest creating a variable and putting in multiple statements. document.getElementById(hash).style.height = '250px';
// Or var elm = document.getElementById(hash); elm.style.height = '250px'; elm.style.border = '1px solid 000000'; elm.style.cursor = 'pointer'; }
|
|
|
|