Simple custom beautiful checkbox _ HTML/Xhtml _ webpage creation can be achieved without too much code using hyperlinks

Source: Internet
Author: User
The checkbox style in html is limited, and a lot of code is required to create a checkbox. The following describes how to use hyperlinks to implement simple custom beautiful check boxes, if you are interested, don't miss out and suddenly think about it today. The style of the checkbox in html is limited, and now you need to write a lot of code to create a checkbox, then I came up with a simple implementation method. This proves completely feasible. If you don't talk about it, paste the source code directly for your reference.

Effect:

When not selected:

Image Background:

CheckboxSel.jpg

CheckboxNoSel.jpg

Code:

Html code snippet:

The Code is as follows:


Monday


JavaScript code snippet:

The Code is as follows:


$ ("A [name = 'checkweek']"). click (function (){
If ($ (this). hasClass ('pcheckboxsel ')){
$ (This). removeClass ('pcheckboxsel ');
} Else {
$ (This). addClass ('pcheckboxsel ');
}
});


Css code snippet:

The Code is as follows:


. PCheckBoxNoSel {
Background: url ("../image/checkboxNoSel.jpg") no-repeat center;
Float: left;
Width: 15px;
Height: 15px;
Border: 1px solid # BDBDBD;
Color: # FFF;
}
. PCheckBoxSel {
Background: url ("../image/checkboxSel.jpg") no-repeat center;
Float: left;
Width: 15px;
Height: 15px;
Border: 1px solid # BDBDBD;
Color: # FFF;
}


There are many ways to differentiate between each hyperlink. In fact, a single hyperlink button can be easily implemented, saving time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.