In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to call the javascript method in a tag". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to call the javascript method in the a tag.
Methods: 1, use "" sentence; 2, use "" sentence; 3, use "" sentence.
The operating environment of this tutorial: windows7 system, javascript1.8.5&&HTML5 version, Dell G3 computer.
Several methods of calling javascript method in a tag
Method 1:
This is a common method on our platform, but it is easy to cause problems when passing parameters such as this, and when the _ javascript: protocol is used as the href attribute of a, it will not only cause unnecessary triggering of the _ window.onbeforeunload event, but also cause gif animation images to stop playing in IE. W3C standards do not recommend executing javascript statements in href
Method 2:
This approach is similar to the two except that an empty piece of js code is executed.
Method 4:
This method clicks to execute the js function after return false, the page does not jump, after execution is still in the current position of the page.
I looked at the home page of taobao. They used the second method, while the home page of alibaba used the first method. The difference from us is that the javascript method in each href is surrounded by try and catch.
To sum up, the most appropriate way to call the js function in an is recommended:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.