开发者

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

开发者 https://www.devze.com 2023-03-31 09:03 出处:网络
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,

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/" 开发者_StackOverflow中文版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..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号