This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes method on click in HREF Link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "method on click in HREF Link" Watch "method on click in HREF Link" New topic

method on click in HREF Link

vineet kumar chaudhry
Ranch Hand

Joined: Apr 02, 2011
Posts: 45
I have the page like
<a href ="contact.htm">Contact</a>
<a href ="admin.htm">Admin</a>
I ma considering contact as id for below example
Now I want : When contact button is clicked its " id " should be captured i.e. contact and a new page html(contact.htm in this case) should be created and the user should see contact.htm

Similarly I wanna do with admin.htm

Basically I need to create the page before displaying

Can anybody help me what would be the javascript used.I am using Apache Velocity for creating the html pages which are generated when the java code is run

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Reason why the serverside is not adding the ids? Seems like the logical place for it to be.

You just need to add an onclick handler to the links



I agree. Here's the link:
subject: method on click in HREF Link
Similar Threads
Facing problem when I am mixing struts and AJAX
problem with the popup
a regular expression search and replace program
html-only jsp page displaying source in safari browser on a mac
Help with tabbed Panel