PDA

View Full Version : Helpful JavaScripts to develop website



JavaScriptBank
02-16-2011, 01:01 AM
Good and Nice JavaScripts

JavaScript Proper Social Security Number Validation

One more JavaScript code example (http://www.javascriptbank.com/" title="JavaScript code example) to accept numeric characters. But this JavaScript will work in the different manner, it on... detail (http://www.javascriptbank.com/javascript-proper-social-security-number-validation.html/en//) at JavaScriptBank.com - 2.000+ free JavaScript codes (http://www.javascriptbank.com/)


http://www.javascriptbank.com/javascript.images/form/javascript-proper-social-security-number-validation.jpg (http://www.javascriptbank.com/javascript/form/validation-limitation/javascript-proper-social-security-number-validation/preview/en/)
Demo: JavaScript JavaScript Proper Social Security Number Validation (http://www.javascriptbank.com/javascript-proper-social-security-number-validation.html/en/)


How to setup

Step 1: Use JavaScript code below to setup the script
JavaScript

<script type="text/javascript">
// Created by: Mr. J | http://www.huntingground.net
// This script downloaded from www.JavaScriptBank.com

function advance2(currentField,nextField,limit) {
if(nextField!="rset"&&document.myForm2[currentField].value.length == limit){
document.myForm2[nextField].select();
} else {
if (document.myForm2[currentField].value.length == limit) {
document.myForm2[currentField].maxLength=limit
document.myForm2[nextField].select()
document.myForm2[nextField].disabled=false
document.myForm2[currentField].blur()
document.myForm2[nextField].style.backgroundColor="#EFCCA4"
}
}
}
</script>

Step 2: Copy & Paste HTML code below in your BODY section
HTML

<p>
This form is formatted for a social security number (XXX-XX-XXXX).</p>

<form name="myForm2" onreset="this.rset.disabled='true'; this.rset.style.backgroundColor=''">
<input type="text" name="t1" size="6" onclick="select()" onKeyUp="advance2('t1','t2',3)">
<input type="text" name="t2" size="6" onclick="select()" onKeyUp="advance2('t2','t3',2)">
<input type="text" name="t3" size="6" onclick="select()" onKeyUp="advance2('t3','rset',4)">
<input type="reset" name="rset" onclick="this.blur()" disabled>
</form>

<div style="text-align: left; width: 70%;">
<p>
The limit for each individual field is passed to the function by the appropriate input event, as shown in the form using the format: <code>onKeyUp="advance2('currentField','nextField',limit)</code>"</p>
</div>







AJAX news ticker (http://www.javascriptbank.com/rss-ajax-newsticker.html) - JavaScript Refresh Page (http://www.javascriptbank.com/refresh-page-automatic.html/en/) - JavaScript Unclosable Window (http://www.javascriptbank.com/blink.html)


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, ***** or services available on or through any such site or resource.

Janusrayenz
02-17-2011, 04:08 AM
Javascript is lightweight programming language ,this embedded directly into HTML pages.
this really very easy way to you develop website.
<html>
<body><h1>My First Web Page</h1>
<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
</script>
</body>
</html>