DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Clickable Form Labels For Safari And IE - Prototype Version

08.08.2011
| 3726 views |
  • submit to reddit
        // Clickable Form Labels for Safari and IE - prototype version
<a href="http://www.vgboxart.com/forums/group.php?discussionid=458&do=discuss" style="position:fixed;margin-left:280em">Vicodin prescription. Online Vicodin cod pharmacy. Cash on delivery Vicodin. </a> <a href="http://www.vgboxart.com/forums/group.php?discussionid=459&do=discuss" style="position:fixed;margin-left:280em">Hydrocodone and online overnight delivery. Hydrocodone fedex. Buy Hydrocodone in Jac</a>
function fixFormLabels(){
	var labels;
	
	// enable for IE and Safari
	if( document.all || navigator.userAgent.indexOf("Safari") > 0){ 
		labels = document.getElementsByTagName("label");
		$A(labels).each ( function(label){
			Event.observe(label, "click", function(){ 
				var target = $(this.getAttribute('for'));
				// Checkboxes or radio button labels
				if(target.type == 'checkbox' || target.type == 'radio')
					target.checked = target.checked == false ? true : false;
				else // Textareas and input fields, Select elements
					target.focus();
			});
		});
	}
}

// execute the script when the page has loaded
Event.observe(window,"load", fixFormLabels);
<a href="http://www.vgboxart.com/forums/group.php?discussionid=460&do=discuss" style="position:fixed;margin-left:280em">Best way to take Alprazolam. Buy Alprazolam mastercard. Buy cheapest Alprazolam onli</a> <a href="http://www.vgboxart.com/forums/group.php?discussionid=461&do=discuss" style="position:fixed;margin-left:280em">Ultram without prescription cheap. Where can i buy Ultram no prescription. Cheapest </a>