Sunday, 31 October 2010

IDAT 102

This is the forth JavaScript tutorial here i am showing you how to make an argument within JavaScript what i have done is made a pop up box asking if you want pop ups if you click yes it comes up with another pop up box saying "here is the pop up message" but if you click no it says "you have chose not to have a pop up message.
Here's the script:
<head> This starts the head tag off
<script type="text/javascript"> This is the script type which is JavaScript
var prompt_text = prompt("Do you want a popup message?","type yes or no"); This is the prompt text variable but instead of the last prompt text we made this one asks for you to type in yes or no because it asks you a question.

if(prompt_text=="yes") This says if the prompt_text variable == yes move to the alert("here is the pop up message").
{
    alert('here is the popup message'); This is the text of the next pop up box alert brings the pop up box up.
}
else This means if yes isn't pressed do the next paragraph.
{
    alert('you chose not to have a popup message') This says pop up and say you have chose not to have a pop up message.
}

</script>This ends the script tag


This shows a very good example of how to get your audience to interact with your website by typing in a pop up box.
this is a very basic argument JavaScript script.

No comments:

Post a Comment