Folks,
I am new to JavaScript. I am working on a numerological project and can’t get a name to reduce to one digit that is between 1 & 9. I also don’t know how to just add the consonants for one operation, and just the vowels for another.
Here is the script I have that is not quite working:
<html>
<head>
<title>Name Number</title>
<script language=”JavaScript”>
<!–
function calcNumber()
{
var yourname=(myform.yourname.value.toUpperCase());
var alphabet=”abcdefghijklmnopqurstuvwxyz”;
var consonant=”bcdfghjklmnpqrstvwxyz”;
var vowels=”aeiou”;
//var yournum;
var total=0;
alert(yourname);
for(i=0; i<yourname.length; ++i)
{
total += (yourname.charCodeAt(i)-65)%9+1
}
alert(total);
total+=””;
//alert(total.charAt(0));
yournum=0;
for(i=0; i < total.length; i++)
{
//alert(“digit#+(i+1+: “+total.charAt(?));
yournum+=eval(total.charAt(i));
//alert(“yournum: ” +yourname);
}
document.write(“This is your Name Number. It is the story of your life.” );
document.write (” It affects how you will write, produce, direct, and perform in the play called Life. “);
document.write (“This is not the complete picture of who you are. “);
document.write (“Look at the Personality Number and the Heart numbers for a fuller picture of who you are “);
document.write (“The combination of the name, personality, and heart numbers is how you interact with others. “);
document.write (“This is where your talents lie. Your name Number is ” +yournum);
}
//–>
</SCRIPT>
</head>
<body bgcolor=”beige”>
<p>
<form name=”myform” action=”calcNumber()”>
Please write your name as it appears on your birth certificate.
<p>
<input type=”text” name=”yourname” maxlength= “50” size=”35″ value=””>
<p>
Send info by clicking on this button:
<p>
<input type=”button” value=”Submit” onClick=”calcNumber()”>
</form>
<p>
</body>
</html>
I’d really appreciate any help you care to offer.
Thanks,
Lionel