Solved

Javascript location

Posted on 2006-11-24
2
496 Views
Last Modified: 2013-11-19
Hi,

I want to handle a menu (highlighting item when user click on the item) with javascript.
can I put the javascript code just before the html code of the menu ?

I'm asking this because the menu is in a separate jsp file.

**** menu_top.jsp ****

<div id="menu_top">
      <div>
            Manage:
            <ul>
                        <li><a href="/users">Users</a></li>
                        <li ><a href="Setup?do=menu_collections">Collections</a></li>
                        <li><a href="/indexes">Mode Test</a></li>
                        <li><a href="Setup?do=menu_options">Options</a></li>
            </ul>
      </div>
      <hr class="separator"/>
</div>


**** collections.jsp (including the menu) ****

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/master.css" rel="stylesheet" type="text/css">
<LINK href="theme/header.css"  rel="stylesheet" type="text/css">
<LINK href="theme/menu_top.css"  rel="stylesheet" type="text/css">
<LINK href="theme/menu_left_index.css"  rel="stylesheet" type="text/css">
<LINK href="theme/footer.css"  rel="stylesheet" type="text/css">
<TITLE>Fortis Crawler Admin</TITLE>
</HEAD>
<BODY id="body">

      <jsp:include page="incl/header.jsp"/>
      <jsp:include page="incl/menu_top.jsp"/>
      <jsp:include page="incl/menu_left_index.jsp"/>
   [...]



Thank u.
0
Comment
Question by:matthew016
2 Comments
 
LVL 16

Accepted Solution

by:
alain34 earned 250 total points
ID: 18008005
yes, javascript can be set anyware in the html document if you are declaring function. However, if it is not a function, the code will be executed straight away.
0
 
LVL 3

Assisted Solution

by:Masoudgh
Masoudgh earned 250 total points
ID: 18008405
yes you can, see this link for complete information : http://www.w3schools.com/js/js_whereto.asp
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need to learn promise API 2 28
Condidional <a href = ....> 1 24
HTML page and JavaScript 2 51
JavaScript error 1 33
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now