Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var totalCount = 0;
- var maxCount = 4;
- var highlightColor = '#f00';
- function change(e)
- {
- if (totalCount < maxCount || e.checked == false)
- {
- if (e.checked == true)
- {
- totalCount++;
- e.parentNode.style.backgroundColor = highlightColor;
- } else {
- totalCount--;
- e.parentNode.style.backgroundColor = '';
- }
- } else {
- alert('You have already selected the maximum number: ' + maxCount);
- e.checked = false;
- }
Add Comment
Please, Sign In to add comment