mrlol1
10-03-2011, 11:14 PM
Hi Folks,
I've been trying to learn Javascript, I'm fluent with CSS, HTML and not to bad with jQuery and PHP. But I've been trying to learn the core fundamentals of JavaScript.
Basically, I have a friend who has a strange take on the English language, so I wanted to make him a translator, so that you could input one of his misspellings and it would bring up the proper word.
<html>
<head>
<script type="text/javascript" src="js/modernizr.js"></script>
<script type="text/javascript">
// Mox spellings
function checkMox ()
{
var bm = document.forms["transMox"]["mox"].value;
if
(bm == "wid") {
document.write("wid = with");
}
else
{
document.write("Please enter a Moxism");
}
};
</script>
</head>
<body>
<header>
<div id="title">
<h1>I drink!</h1>
<h2>Therefor I am...</h2>
</div>
<nav>
<ul>
<li>The history of Moxisms</li>
<li>Examples of Moxisms</li>
<li>The man himself...</li>
</ul>
</nav>
</header>
<h3>Welcome to the Big Mox translator</h3>
<form id="transMox" action="#output" method="post" onsubmit="return checkMox()">
<input type="text" id="mox">Enter a Moxism</input>
<br />
<input type="submit" id="submit" onSubmit="checkMox();">G0!</input>
</form>
<div id="output">
</div>
</body>
</html>
Obviously that's just for one word, so I wondered how to structure more words into an array or something?
Anyway, cheers in advance for the help guys!
I've been trying to learn Javascript, I'm fluent with CSS, HTML and not to bad with jQuery and PHP. But I've been trying to learn the core fundamentals of JavaScript.
Basically, I have a friend who has a strange take on the English language, so I wanted to make him a translator, so that you could input one of his misspellings and it would bring up the proper word.
<html>
<head>
<script type="text/javascript" src="js/modernizr.js"></script>
<script type="text/javascript">
// Mox spellings
function checkMox ()
{
var bm = document.forms["transMox"]["mox"].value;
if
(bm == "wid") {
document.write("wid = with");
}
else
{
document.write("Please enter a Moxism");
}
};
</script>
</head>
<body>
<header>
<div id="title">
<h1>I drink!</h1>
<h2>Therefor I am...</h2>
</div>
<nav>
<ul>
<li>The history of Moxisms</li>
<li>Examples of Moxisms</li>
<li>The man himself...</li>
</ul>
</nav>
</header>
<h3>Welcome to the Big Mox translator</h3>
<form id="transMox" action="#output" method="post" onsubmit="return checkMox()">
<input type="text" id="mox">Enter a Moxism</input>
<br />
<input type="submit" id="submit" onSubmit="checkMox();">G0!</input>
</form>
<div id="output">
</div>
</body>
</html>
Obviously that's just for one word, so I wondered how to structure more words into an array or something?
Anyway, cheers in advance for the help guys!