简体   繁体   中英

how to add different Href and onCick in ANCHOR TAG for a Ajaxed based website?

I am developing a Ajax based web application.I want to add HREF and OnClick, both to the anchor tag .
This I want to do because of 2 reasons,

  1. To keep the web application SEO friendly.'
  2. Secondly, if user does a "left click event" in that case I want to call AJAX query and in case of "right click event", I want to open a page in new TAB or Window.

I was trying following code but its not working.

<A href="http://www.website.com/" onClick="alert("right click event fired"); return false;">stuff</A>

My question is, Is it possible to achieve case?

this might work

  <A href="http://www.website.com/" onClick="alert('right click event fired');return false;">stuff</A>

the double quotes were getting closed in the middle..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM