Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use the two link in one onclick

Posted on 2011-03-21
17
Medium Priority
?
268 Views
Last Modified: 2012-05-11
<a href="baktha.doc" onClick="call javascript function"/>

at the time of click to call both href and onclick,

please help is't possible or not in simple jsp otherwise how to use struts jsp tages anything else
<a href="baktha.doc" onClick="call javascript function"/>

Open in new window

0
Comment
Question by:Sachin_Ajmani
[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
  • 3
  • 3
  • 2
  • +5
17 Comments
 

Author Comment

by:Sachin_Ajmani
ID: 35179322
<a href="baktha.doc" onClick="call javascript function"/>
0
 
LVL 2

Expert Comment

by:ramkihardy
ID: 35179353
simple you can do like this....
make one href as invisible and one as visible place the two hrefs one above the other...if a user click
both the hrefs are clicked......
 <a href="baktha.doc" onClick="call javascript function"/>
 <a href="xyz.doc" onClick="call javascript function"/>
otherwise u can use like this
 <a href="baktha.doc" onClick="javascript function"/>
within the javascript function...call both the javascript function you want to call...this might solve your problem...

Let me know if u want any help...
Regards
Ramki
0
 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 2000 total points
ID: 35179372
onClick="javascript :function1();function2()"/>
0
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!

 
LVL 19

Expert Comment

by:Bardobrave
ID: 35179385
Usually the best approach for these situations is to fire both commands from within javascript. Get rid of A tag's href (or pass it as a parameter to javascript function if it's needed) and launch the link after completing javascript call.
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35179391
looks like you want to open a document and also call a javascript function,

You can do both using javascript, so you don't need a href attribute

<a href="#" onClick="function1('baktha.doc')"/>

function function1(url)
{
   window.open(url);
   //call other javascript function
}
0
 
LVL 7

Expert Comment

by:Maverick_Cool
ID: 35179418
the onclick function should return true, then only href will work.
0
 
LVL 10

Expert Comment

by:khan_webguru
ID: 35180291
Hello Bro!

If you want that after client side click function href=""  should also be work then you have to write the code like this:

 
<a href="baktha.doc" onClick="testFuncation();return true;"/>

Open in new window



I am assuming that your function name is "testFunction();"  after this just add "return true;". You can do this in you funcation as well rather then write in <a> tag like this:

 
<a href="baktha.doc" onClick="testFuncation();return true;"/>

Open in new window



hope this will solve your problem.

Regards,

Asif Ahmed Khan
function testFunction()
{
   // your code logic


   //then return true
   return true;

}

Open in new window

0
 
LVL 10

Expert Comment

by:khan_webguru
ID: 35300695
any success???
0
 
LVL 7

Expert Comment

by:Maverick_Cool
ID: 35305706
why is the question being closed? Provide proper reason.
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35315478
User didnt tell the correct reason to close the question
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35355521
i mention correct solution http://#35179372
0
 
LVL 7

Expert Comment

by:Maverick_Cool
ID: 35357440
I had given correct direct in POST ID: 35179418
0
 

Expert Comment

by:WallyMod
ID: 35410446
In the abscence of the authors response anywhere in the thread, the recommendation is to accept the post by dravidnsr in http:Q_26900087.html#a35179372 as this is the first explicit entry relating to calling two functions in the one click.

WallyMod
Community Support Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Read on to get a few ideas on how to promote your next corporate event.
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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