Javascript - Compare two Dates
function CompareDates() {
var txtEffDt = document.getElementById("txtEffectiveDt").value.split("/");
var txtExpDt = document.getElementById("txtExpiryDt").value.split("/");
var date1 = new Date(txtEffDt[2]+'/'+txtEffDt[0]+'/'+txtEffDt[1]);
var date2 = new Date(txtExpDt[2]+'/'+txtExpDt[0]+'/'+txtExpDt[1]);
if (date1 > date2) {
alert("Expiry Date cannot be less than Effective Date");
return false;
}
}
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Wednesday, February 4, 2009
Tuesday, February 3, 2009
Javascript - Convert Number to words
Javascript - Convert Number to words
link the script into the head of your page using the following code:
The final step is to call the script to perform the conversion to words for you. To get a number converted to words you just need to call the function passing it the number you want to convert and the corresponding words will be returned.
var words = toWords(num);
// Convert numbers to words
// American Numbering System
var th = ['','thousand','million', 'billion','trillion'];
// uncomment this line for English Number System
// var th = ['','thousand','million', 'milliard','billion'];
var dg = ['zero','one','two','three','four', 'five','six','seven','eight','nine']; var tn = ['ten','eleven','twelve','thirteen', 'fourteen','fifteen','sixteen', 'seventeen','eighteen','nineteen']; var tw = ['twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety']; function toWords(s){s = s.toString(); s = s.replace(/[\, ]/g,''); if (s != String(parseFloat(s))) return 'not a number'; var x = s.indexOf('.'); if (x == -1) x = s.length; if (x > 15) return 'too big'; var n = s.split(''); var str = ''; var sk = 0; for (var i=0; i < 3="="2)" sk="1;}" sk="1;}}" 3="="0)" sk="1;}" 3="="1)" sk="0;}}" y =" s.length;" i="x+1;">
Subscribe to:
Posts (Atom)