|
Post by Sora on Nov 4, 2011 12:13:52 GMT -5
Lesson Two: MAKING A PROMPT
As I said before, Javascript is plenty powerful. We can go in any one of a dozen directions with this. What I'm going to do is wander around here and there, trying to touch on as many basic things as I can. I'll try to explain a little as we go.
So, what now? Let's add a prompt box to ask our name and then spit out a personalized Hello message.
<html> <head> <title></title>
<script type="text/javascript">
function HelloWorld() { myname = prompt("What's yer name bub?", ""); alert("Hello " + myname); }
</script>
</head> <body>
<a href="javascript:HelloWorld()">Hello</a>
</body> </html>
Now save it as an .html file again and try! The prompt the text box that you can type into. This all may seem confusing, but this is just the beginning!
|
|