Difference between revisions of "Times a billion cash can u blog that 34"

From Missouri Academy Wiki
Jump to navigation Jump to search
(Created page with "thumb| Flag this photograph Credit card numbers have diverse formats depending on the credit card kind. To example, Visa, MasterCard plus Dis...")
 
(Blanked the page)
 
Line 1: Line 1:
[[Image:Cash_Advances_3891.jpg|thumb|]]
 
  
 
 
Flag this photograph
 
 
Credit card numbers have diverse formats depending on the credit card kind. To example, Visa, MasterCard plus Discover each format their card numbers in 4 groups of 4 digits separated by means of dashes. American Express formats hers card number in groups of four, six and 5 digits, respectively, separated by way of dashes. You can format a credit card quantity based on the type in JavaScript by using the JavaScript "sprintf" method.
 
 
Trouble:
 
Moderately Challenging
 
 
1 Create a new HTML document in one editor or in Microsoft Notepad. Create a variety to capture the credit card kind and credit card number. Assign a name to each and every input element to easily reference them from JavaScript. For example, type:
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitory//EN website">
 
 
<html xmlns= website">
 
 
<head>
 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
 
<title>Format Credit Card Number</title>
 
 
</brain>
 
 
<body>
 
 
<strong>Pick credit card type:</strong><br/>
 
 
<form title="cc">
 
 
<pick name="ccType">
 
 
<option value="Visa">Visa</option>
 
 
<choice value="MasterCard">MasterCard</option>
 
 
<option value="American Express">American Express</choice>
 
 
</select><br/>
 
 
<strong>Enter credit card number (no dashes):</strong><br/>
 
 
<input kind="text" name="ccNumber" /><br/>
 
 
2 Allot the submit actions to any JavaScript function you will create to format the credit card number. For example, type:
 
 
3 Reserve some place with some <div> tag to display the formatted number. With illustration, type:
 
 
<div id="formatted></div>
 
 
</form>
 
 
</physique>
 
 
<script type="text/javascript">
 
 
function formatcc()
 
 
var cc = website.ccNumber;
 
 
cc.replace(/\-/, "");
 
 
6 Determine the credit card type with using the "switch" statement. Format the credit card quantity by using the "sprintf" function and the "substr" method. Substitute exclusive error information for the formatted card number if the credit card type is not recognized. For illustration, type:
 
 
switch (ccType)
 
 
situation "Visa": case "MasterCard": event "Discover":
 
 
var formatted = sprintf("%04d-%04d-%04d-%04d", cc.substr(0,4), cc.substr(4,4), cc.substr(8,4), cc.substr(12,4));
 
 
break;
 
 
case "American Express":
 
 
var formatted = sprintf("%04d-%06d-%05d", cc.substring(0,3), cc.substr(3,6), cc.substr(9,5));
 
 
break;
 
 
default:
 
 
var foramtted = "Could not identify credit card kind!";. [http://wiki.opensocial.myspace.com/index.php?title=Cash_advance_-_How_do_i_get_an_emergency_cash_advance Cash Advances].
 
 
break;
 
 
7 Replace the space reserved with the <div> tag with the formatted credit card amount. With illustration, type:
 
 
document.getElementById("formatted").innerHTML = "The formatted amount yous " + formatted;
 
 
 
 
</script>
 
 
Related Searches
 
 
References
 
 
SANS: Using Snort to Detect Clear Word Credit Card Numbers
 
Dive In JavaScript: JavaScript sprintf internet site: JavaScript Change Statement website: JavaScript substr() Technique
 
 
Comstock/Comstock/Getty Images
 

Latest revision as of 01:17, 27 July 2012