09 April 2009

0 JavaScript code to disable the corresponding menu bar link and make it bold on loading the page

Here is the JavaScript code to disable the corresponding menu bar link and make it bold on loading the page

Consider an application with three pages. There is a link for each page in the common menu bar. On loading the page the corresponding page’s menu bar should be disabled and bold.

In the common menu bar give an id for each link. Let the id be menu1, menu2 and menu3 for the corresponding links.

For e.g. In the common JSP

<div>

      <span id ="menu1">

<html:link action="/ShowMenu1.do"> Menu1 </html:link> </span>

</div>

<div>

      <span id ="menu2">

<html:link action="/ ShowMenu2.do"> Menu2 </html:link> </span>

</div>

<div>

      <span id ="menu3">

<html:link action="/ ShowMenu3.do"> Menu3 </html:link> </span>

</div>


Use the below script in the first page JSP


<script type="text/javascript">

      document.getElementById('menu1').innerHTML =

'<a> <b> Menu1 </b> </a>';   

</script>



On loading the first page the link Menu1 becomes disabled and bold.



0 comments:

Feeds Comments

Please give your valuable comments.