简体   繁体   中英

call javascript function from anchor html tag

I need to display message when the user clicks link

How can I implement something where once the user click the hyper link on Page1, a "processing..." message and then as soon as Page2 is ready it forwards to Page2?

It is working for button click which I earlier posted got response implemented successfully.Thanks.

Hidden DOM element containing the message and to make it visible

Same thing I tried to implement for the below HTML code which is using Servlet not sure how to implement

        <a href="<%=request.getContextPath()%>/servlet/VisibilityController?searchType=workSearchDetails&workNo=<%=installAtLocListBean.getWorkNumber()%>&ID=<%= firstLocationNumber %>&sitePosition=<%=pagePosition%>"><%=installAtLocListBean.getWorkNumber()%>onclick="MyFunction();return true;"</a></td>

Can any body help me is it possible to do as button click any examples please Thanks in advance

You can use either

<a href="javascript:someFunction()">LINK</a>

or

<a href="#" onclick="someFunction(); return false;">LINK</a>

or you can check this link. anchor tag onclick function

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