So now that we have got our variables collected all we have to do is add the script to display it on the screen. Don't forget to include spaces after words and before variables.
<script language="JavaScript"> var name = prompt("Give me a name",""); var object = prompt("Give me an object",""); var animal = prompt("Name a really cool animal",""); var verb = prompt("Now give me a verb, present tense",""); document.write("One day "); document.write(name); document.write(" was walking down the street, he ran across a "); document.write(object); document.write(" and started to chew on it. "); document.write(name); document.write(" ran down the street as fast as he could, it was like a wild "); document.write(animal); document.write(". "); document.write(name); document.write(" started to "); document.write(verb); document.write(" as fast as he could to get the "); document.write(object); document.write(" out of his throat."); </script>
Results: Click here to see it in action.
It is kind of long, but that's how they all are. And we are done, you can create some a lot faster than this one. Because we didn't have to do all of those steps, try creating your own. |