anchor to sub-menu li on different page using onClick
<p>I've got this working if the link is on the same page as the anchored sub-menu li but haven't been able to get it working if link is on a different page.</p>

<p>here is the working (same page) code</p>

<pre><code>&lt;p&gt;
&lt;a title="go to stories" onclick="switchListing(1,0);return false;" href="mypage#quo" href="mypage#sto"&gt;Stories&lt;/a&gt;
&lt;br /&gt;
&lt;a title="go to quotes" onclick="switchListing(2,0,0);return false;" href="mypage#quo"&gt;Quotes&lt;/a&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class="cd_tab1&lt;?PHP if ((int)($zTab) == 0) {echo " selected";}?&gt;"&gt;&lt;a alt='Updates' href=# onClick='switchListing(0,0);return false;'&gt;Updates&lt;/a&gt;&lt;/li&gt;
&lt;li class="cd_tab2&lt;?PHP if ((int)($zTab) == 1) {echo " selected";}?&gt;"&gt;&lt;a name="sto" alt='Stories' href=# onClick='switchListing(1,0);return false;'&gt;Stories&lt;/a&gt;
&lt;li class="cd_tab3&lt;?PHP if ((int)($zTab) == 2) {echo " selected";}?&gt;"&gt;&lt;a name="quo" alt='Quotes' href=# onClick='switchListing(2,0,0);return false;'&gt;Quotes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>here is my attempt linking from a different page:</p>

<pre><code>&lt;p&gt;
    &lt;a title="go to stories" onclick="$(window).scrollTop($('li.cd_tab2').offset().top);" href="updates-page#sto"&gt;Stories&lt;/a&gt;
    &lt;br /&gt;
    &lt;a title="go to quotes" onclick="$(window).scrollTop($('li.cd_tab3').offset().top);" href="updates-page#quo"&gt;Quotes&lt;/a&gt;
&lt;/p&gt;
</code></pre>

<p>I also tried:</p>

<pre><code>&lt;p&gt;
&lt;a title="go to stories" onclick="$(window).scrollTop($'a[href="mypage#sto"]').offset().top);"&gt;Stories&lt;/a&gt;&lt;br/&gt;
&lt;a title="go to quotes" onclick="$(window).scrollTop($'a[href="mypage#quo"]').offset().top);"&gt;Quotes&lt;/a&gt;
&lt;/p&gt;
</code></pre>

<p>both solutions take me to the correct page but show Tab1 of my sub-menu instead of showing the specific menu tab I want (tab2 or tab3).</p>

<p>any help/guidance is appreciated, thanks!</p>
