Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript location

Posted on 2006-11-24
2
Medium Priority
?
503 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
alain34 earned 1000 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 1000 total points
ID: 18008405
yes you can, see this link for complete information : http://www.w3schools.com/js/js_whereto.asp
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

604 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