/    Sign up×
Community /Pin to ProfileBookmark

body onload=click()

I have a tree menu built from [url]http://www.mycssmenu.com/[/url]

It looks like

[code=html]<ul id=”qm0″ class=”qmmc”>

<li><a class=”qmparent” href=”javascript:void(0)”>Who We Are</a>

<ul>
<li><a href=”javascript:void(0)”>Management</a></li>
<li><a class=”qmparent” href=”javascript:void(0)”>Global Sites</a>

<ul>
<li><a href=”javascript:void(0)”>Asia</a></li>
<li><a href=”javascript:void(0)”>South America</a></li>
<li><a href=”javascript:void(0)”>Australia</a></li>
<li><a href=”javascript:void(0)”>North America</a></li>
<li><a href=”javascript:void(0)”>Europe</a></li>
<li><a href=”javascript:void(0)”>Africa</a></li>
</ul></li>
……….
……….
[/code]

When the user opens the page items are all collapsed.
If he comes from another page with a query string, let’s say main=WWA&second=GMG
I want to automatically expand (I would add id=”WWA”) secondary items.

[code=html]<li id=”WWA”><a class=”qmparent” href=”javascript:void(0)”>Who We Are</a>[/code]

and also (I would add id=”WWA”) third items.

[code=html]<li id=”GMG”><a class=”qmparent” href=”javascript:void(0)”>Global Sites</a>…[/code]

I was triyng onload=click() but it only works with buttons radio and checkboxes within a form.

Do you know a way to perform this?
Thank you.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @marciano spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...