In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use the href attribute of the a tag and the onclick event in html. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The a tag is mainly used to jump pages, either through the href attribute or in the onclick event.
PHP Chinese website
This code is fine in mainstream browsers, but it can't jump in IE6. What is the reason for this?
_ javascript:void (0)
Void (arg); can be understood as a function that always returns null, but its arguments cannot be empty. Its parameters can be arbitrary expressions or even functions.
test
test
IE6 first runs events bound by DOM itself, such as onclick;, which executes the href property sequentially if it does not prevent bubbling. While void (0); does not need to execute any event, IE6 tells the browser not to perform any event (overwriting the previous action), and ending bubbling is equivalent to returnfalse;, so the browser does not perform any action. So all you have to do is to stop bubbling within the onclick event.
PHP Chinese website
In this way, it can work properly under IE6.
Another way is not to use _ javascript:void (0); you can avoid using # instead. The # in the href attribute originally means anchor # name, so it goes to the top of the page when no anchor is specified. # has a specific meaning. The default is # top. If the content after # is considered to be a tag and jumps there from the page to find the corresponding tag, it will jump to the top of the page. If you do not want to jump, you can use #, # is a meaningless tag assignment.
Thank you for reading! This is the end of this article on "how to use the href attribute and onclick event of a tag in html". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see it!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.