Go Back   Themers Club : Computers , Mobiles and Web Development Themes > Webmaster forum > Scripts and Tools

Scripts and Tools Share your free scripts , tools , icons, fontz, screen savers , etc here.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2009, 05:54 AM
JavaScriptBank JavaScriptBank is offline
Senior Member
 
Join Date: Jul 2009
Posts: 207
Rep Power: 16
JavaScriptBank is on a distinguished road
Default Usefull JavaScripts

JavaScript Collector

Radio Question Validator script

Validates that every Radio Button question on the form has been answered. No modifications needed!... detail

[IMG]hxxp ://w w w.javascriptbank. com/javascript.images/form/radio-question-validator-script.jpg[/IMG]
Demo: Radio Question Validator script

How to setup

Step 1: Place JavaScript below in your HEAD section
JavaScript
Code:
<SCRIPT LANGUAGE="JavaScript">
// David Blackledge | hxxp ://david.blackledge. com/

<!-- Begin
function checkRadios() {
 var el = document.forms[0].elements;
 for(var i = 0 ; i < el.length ; ++i) {
  if(el[i].type == "radio") {
   var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   var itemchecked = false;
   for(var j = 0 ; j < radiogroup.length ; ++j) {
    if(radiogroup[j].checked) {
	 itemchecked = true;
	 break;
	}
   }
   if(!itemchecked) { 
    alert("Please choose an answer for "+el[i].name+".");
    if(el[i].focus)
     el[i].focus();
	return false;
   }
  }
 }
 return true;
} 
//  End -->
</script>
	<!--
    	This script downloaded from w w w.JavaScriptBank. com
    	Come to view and download over 2000+ free javascript at w w w.JavaScriptBank. com
	-->
Step 2: Place HTML below in your BODY section
HTML
Code:
<FORM onsubmit="return checkRadios(this);">
Blue:
<input type="radio" value="1" name="blue">
<input type="radio" value="2" name="blue">
<input type="radio" value="3" name="blue">
<input type="radio" value="4" name="blue">
<input type="radio" value="5" name="blue">
<BR>

Red:
<input type="radio" value="1" name="red">
<input type="radio" value="2" name="red">
<input type="radio" value="3" name="red">
<input type="radio" value="4" name="red">
<input type="radio" value="5" name="red">
<BR>

<input type="submit" value="check" name="button">
</FORM>
	<!--
    	This script downloaded from w w w.JavaScriptBank. com
    	Come to view and download over 2000+ free javascript at w w w.JavaScriptBank. com
	-->
Quote:
Originally Posted by Copyright
The Site may provide, or third parties may provide, links to non-JavaScriptBank.com Internet World Wide Web sites or resources. Because JavaScriptBank.com has no control over such sites and resources, you acknowledge and agree that JavaScriptBank.com is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that JavaScriptBank.com shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.
Reply With Quote
  #2  
Old 09-10-2009, 06:58 AM
GreenLight00
Guest
 
Posts: n/a
Default

thanxxx for your useful Javascripts.
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 12:31 PM.


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.