Cookies Storing information on the visitors computer then retrieving this

Cookies storing information on the visitors computer

This preview shows page 11 - 21 out of 64 pages.

Cookies Storing information on the visitor's computer, then retrieving this information automatically next time the user visits your page. This technique is called "cookies". Control Browsers Opening pages in customized windows, where you specify if the browser's buttons, menu line, status line or whatever should be present. Validate Forms Validating inputs to fields before submitting a form. An example would be validating the entered email address to see if it has an @ in it, since if not, it's not a valid address.
Image of page 11
Application of JavaScript Text animation Graphic animation Simple browser based application HTML forms submission Client-side forms data validation (relieving the server of this task) Web site navigation
Image of page 12
JavaScript Statements <html> <head><title>My Page</title></head> <body> <script language="JavaScript"> document.write('This is my first JavaScript Page'); </script> </body> </html> Note the symbol for line continuation
Image of page 13
JavaScript Statements <html> <head><title>My Page</title></head> <body> <script language=“JavaScript"> document.write(' <h1> This is my first JavaScript Page </h1> '); </script> </body> </html> HTML written inside JavaScript
Image of page 14
JavaScript Statements <html> <head><title>My Page</title></head> <body> <p> <a href="myfile.html">My Page</a> <br /> <a href="myfile.html" onMouseover="window.alert('Hello');" > My Page</A> </p> </body> </html> JavaScript written inside HTML An Event
Image of page 15
Example Statements <script language="JavaScript"> window.prompt('Enter your name:',''); </script> <form> <input type="button" Value="Press" onClick="window.alert('Hello');"> </form> Another event Note quotes: " and '
Image of page 16
JavaScript Functions and Events A JavaScript function is a block of JavaScript code, that can be executed when "asked" for. For example, a function can be executed when an event occurs, like when the user clicks a button. JavaScript in <head> JavaScript in <body>
Image of page 17
External JavaScript It is a good idea to place scripts at the bottom of the <body> element. JavaScript files have the file extension .js . Cached JavaScript files can speed up page loads. Client side scripting language. Making web pages more dynamic, interactive JavaScript is a browser-based scripting language developed by Netscape and implemented in all major browsers. All major web browsers contain JavaScript interpreters, which process the commands written in JavaScript.
Image of page 18
JavaScript Outputs JavaScript can "display" the output data in different ways: Writing into an alert box, using window.alert() . Writing into the HTML output using document.write() . Writing into an HTML element, using innerHTML . Writing into the browser console, using console.log() <script> window.alert(5 + 6); </script> <script> document.write(5 + 6); </script> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = 5 + 6; </script>
Image of page 19
JavaScript Syntax: JavaScript is a programming language . JavaScript statements are separated by semicolon .
Image of page 20
Image of page 21

You've reached the end of your free preview.

Want to read all 64 pages?

  • Fall '19
  • Document Object Model

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes