It's not a secret anymore!
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
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: 15385
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
It's not a secret anymore!