This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
Author

method on click in HREF Link

vineet kumar chaudhry
Ranch Hand

Joined: Apr 02, 2011
Posts: 45
I have the page like
[code]
<a href ="contact.htm">Contact</a>
<a href ="admin.htm">Admin</a>
[code]
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

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

onclick="appendId(this);"

Eric



 
 
subject: method on click in HREF Link