You removed the last } from your function!
You had that right before. Why did you change that?
HINT: The number of { and } in any program must be the same.
Ditto for [ and ].
Ditto for ( and ).
If you would indent your code sensibly you would see this.
Code:
<html>
<head>
<title>Translator</title>
<script type="text/javascript">
function checkOranges(numOranges)
{
if(numOranges == "hi")
{
alert("hai");
}
else if (numOranges == "lol")
{
alert("Laugh out loud");
}
}
</script>
</head>
<body>
<h3>Internet abriviation translator</h3>
<form method="POST" name="orangesform"
onSubmit="checkOranges(document.orangesform.numOranges.value); return false;">
<input type="text" name="numOranges" id=numOranges />
<input type="Submit" name="Submit" />
</form>
</body>
</html>
A better way to write this:
Code:
<html>
<head>
<title>Translator</title>
<script type="text/javascript">
var dictionary = {
"hi" : "hai",
"lol" : "Laugh Out Loud",
"rotflmao" : "Rolling on the floor laughing my *** off",
"fwiw" : "For what it's worth"
};
function dotranslate( btn )
{
var word = btn.form.translateFrom.value;
btn.form.translateTo.value = dictionary[ word.toLowerCase() ];
}
</script>
</head>
<body>
<h3>Internet abbreviation translator</h3>
<form method="get">
Abbreviation: <input type="text" name="translateFrom" /><br/>
<input type="button" value="Translate!" onclick="dotranslate(this);" /><br/>
Translation: <input type="text" name="translateTo" readonly /><br/>
</form>
</body>
</html>