Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove a tags and buttons and add dotted lines / shadows to background pictures

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to remove a tags and buttons and add dotted lines / shadows to background images. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

When the user registers, they will click on an a tag to change the CAPTCHA. When clicked, there is a shadow on the a tab. For those who like beauty, it is intolerable!

What is the reason for this? It turned out that it was the href attribute of the a tag that caused the trouble.

1. Only a tag

There are two solutions to what I know.

One: prescribe the right medicine to the case. Since it was caused by href. Then remove the href attribute.

When we use href=_javascript:RefreshCode (); just update the CAPTCHA. There is no jump to the page.

The code is as follows:

can't see clearly? Change the picture.

So you can remove the href, tag a with the onclick event, and call the update CAPTCHA function.

The code is as follows:

can't see clearly? Change the picture.

Second: take a step back. seek common ground while reserving differences. Since you want to use the href property. Okay. Then I'll add another event for you: onfocus.

As long as you modify it, you can perfect it and add an onfocus= "this.blur ()" to the a tag.

That's for sure. If you want the a label to be ununderlined. Style= "text-decoration: none"

The code is as follows:

can't see clearly? Change the picture.

The effect after modification is completed

In browsers such as FF, it is relatively easy to define the style outline:none; for tag a directly, that is:

The code is as follows:

A {outline:none;}

Of course, this is just the removal of a single. If the page has multiple a tags, shouldn't you add onfocus events one by one?

Of course not. We can do it when the page is loaded. Get all the a tags on the page by: window.document.links.length (where window can be omitted). Then iterate over the registration event.

The code is as follows:

_ window.onload=function () {

For (var item0; I

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report