Sunday, 31 October 2010

IDAT 102

This is the 3rd tutorial in JavaScript here i made a pop up box where you enter your name and then it personalizes the page saying "good morning" + your name.
Here is the script for the Javascript:
<head> This starts the head tag
<script type="text/javascript"> This is the script type which is JavaScript.
var prompt_text = prompt("Please type your name"); This is a variable for prompt_text, Prompt is the pop up and the text is where you type in your name.
</script> This ends the script tag

</head> This ends the head

<body> This starts the body tag
<script type="text/javascript"> This starts the script tag and is a text/JavaScript file.
document.writeln("Good morning," +prompt_text); This writes a line in the document saying good morning plus the prompt_text which is what you write in when the pop up box appears.
</script>


This is a good example of using the variable script because it can be used for writing in text boxes and using it for input fields.

No comments:

Post a Comment