All that inline styling and javascript just makes it all harder to
figure out...

Why are you splitting the hash if it's exactly equal to the href? And
what do you mean by "activate the class"? Add it to the element?

Theretically this should be enough:

$(document).ready(function(){
   var hash = document.location.hash;
   if (hash) {
      $('a[href*='+hash+']').click()
   }
});

Some advice: put all the styling in a <style> tag or external CSS, and
add all the event handlers using jQuery:

$('element').click(function(){
   //do something
});

as documented in docs.jquery.com/Events

that makes things really easier to work with.

If for some reason you don't want to do that, at least drop the
camelcase attributes, they are not standard and won't work in firefox
(onclick, onmouseout).

cheers,
- ricardo

On Nov 22, 12:22 pm, "Mr.Ilia" <[EMAIL PROTECTED]> wrote:
> I have index.html#members_kihon_image10 . When I enter it in URL it
> perfectly loads what I need.
>
> What I can't do is to also make a class selected inside of a tag on
> hash click?
>
> here is html
>
> <div class="cur" style="position:absolute; width:94px; height:
> 58px;"><a href="#members_kihon_image10" class="scrollToId_img10_lyr1"
> onClick="mActive(this); javascript:loadintoIframe('video-frame',
> 'videos/3.html'); " name="img10"><img src="../../images/off.gif"
> border=1 name="img10" onMouseOver="mOver(this)" onMouseOut="mOut
> (this)" onClick="mActive(this)" /></a></div>
>
> here is the class that has to be activated on hash click (on regular
> mouse click it works)
>
> class="scrollToId_img10_lyr1"
>
> here is the jquery javascript which should be added with some that
> would activate the class inside of A:
>
> $(document).ready( function () {
>
> if (document.location.hash) {
>    var pnp = document.location.hash.split('_');
>
>    $("a[href='"+pnp[0]+"']").click();
>
>   if (pnp[1]) {
>          $("a[href='"+pnp[0]+'_'+pnp[1]+"']").click();
>    }
>
>     if (pnp[2]) {
>       $("a[href='"+location.hash+"']").click();
>    }
>
> }
>
>         if ($.browser.mozilla) {
>                 $('a').click(function() {
>                         this.blur();
>                 });
>         }
>
>         });
>
> Should be very easy, right?
>
> Ilia

Reply via email to