<html>
<head>
<title><!--Sample--></title>
<script type="text/javascript">
<!--
function abc()
{ var validValue = /^[1-9]{1,4}$/;
var openValue = /[0-9]/;
var a = prompt('What is a\'s value?', 'Value goes here!');
do { if (!validValue.test(a)) {
alert('You must enter a valid number value not lower than 1!');
a = prompt('What is a\'s value?', 'Value goes here!'); }
}
while(!validValue.test(a));
var b = prompt('What is b\'s value?', 'Value goes here!');
do { if (!validValue.test(b)) {
alert('You must enter a valid number value not lower than 1!');
b = prompt('What is b\'s value?', 'Value goes here!'); }
} while(!validValue.test(b));
var c = prompt('What is c\'s value?', 'Value goes here!');
do { if (!openValue.test(c)) {
alert('Invalid character value, please enter another value!');
c = prompt('What is c\'s value?', 'Value goes here!'); }
} while(!openValue.test(c))
var abcValue = ( a.valueOf() * 1) + (b.valueOf() * 1) + (c.valueOf() * 1);
if ( document.all && !document.getElementById) {
document.all.total.innerText = abcValue; }
else if (document.getElementById) {
document.getElementById('total').innerText = abcValue; }
}
/* To make it available to all major browsers' */
if (window.addEventListener)
window.addEventListener('load',abc,false);
else if (window.attachEvent)
window.attachEvent('onload',abc)
else if (document.getElementById)
window.onload = abc;
//-->
</script>
</head>
<body>
<!-- Just to catch the total value of a b and c! -->
<div id="total"></div>
</body>
</html>