Targetting elements via javascript... how?


the following code navigation menu 1 option appears lit @ time (based on code sent me amazing jon fritz ii).

 

css:

a#button0, a#button1 {

    display:block;

    float:left;

    width:55px;

    height:67px;

    margin:0;

}

a#button0.inactive{ background:url(/carousel_home.png) -55 0 no-repeat }
a#button0.active{ background:url(/carousel_home.png) 0 0 no-repeat }
a#button1.inactive{ background:url(/carousel_vip.png) -55px 0 no-repeat }
a#button1.active{ background:url(/carousel_vip.png) 0 0 no-repeat }

 

html:

<a href="#" onclick="changeclass(this)" class="inactive menu" id="button0"> </a>

<a href="#" onclick="changeclass(this)" class="inactive menu" id="button1"> </a>

 

jscript:

<script>

function changeclass(elclass) {

  var divslength =  document.getelementsbyclassname("menu").length;

  (i = 0; < divslength; i++) {

    document.getelementsbyclassname("menu")[i].classname = "inactive menu";

  }

  elclass.classname = "active menu"; 

}

</script>

 

what swap class of clicked button (in menu) while reverting other buttons original state, 1 button appears "lit" @ time. tags used block elements shift background image produce "lit" , "unlit" state.

 

my question is... via javascript (or else), possible trigger class changes buttons area outside menu? in other words, can make text link on page trigger button in menu "light up". <a href="javascript:slide('div1'); javascript:(go light button1)">example</a>

 

the reason menu not way 1 section another. if click on link in div on same page takes me area, ideally, i'd see button representing area in nav menu light it's been clicked on -- if hasn't. , of course, other buttons not lit.

 

thanks!

my question is... via javascript (or else), possible trigger class changes buttons area outside menu? in other words, can make text link on page trigger button in menu "light up". <a href="javascript:slide('div1'); javascript:(go light button1)">example</a>

 

sure - using same method jon gave you.  javascript "getelementbyid()" function target element on page.



More discussions in Dreamweaver support forum


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support