I am trying to teach myself javascript. I found
http://www.webmonkey.com/2010/02/Jav...ial_-_Lesson_1 very valuable - the only tutorial I actually understood.
In a different trial, I have succeeded to capture user data with a prompt and then run two conditional if statements...
...but, prompts seem old and dumb to me so I am trying to capture user data with a textbox instead of a prompt and I'm running into failure. Here is what I am trying to do:
1. user puts data into textbox
2. I get value of textbox
3. I do a calculation with that value
4. I write the answer
This is what I've got:
Enter your birth year: <input type="text" id="birthyear" onblur="age ()">
<script>
function age()
{
var birthyear = document.getElementById('birthyear').value;
var today = 2012;
var age = today - birthyear;
document.writeln (age);
}
</script>
Please don't be too harsh on me
If you have a good tutorial to refer me to that'd be awesome too.