Javascript Java Script is what is called a

  • Slides: 4
Download presentation
Javascript Java. Script is what is called a client-side scripting language: a programming language

Javascript Java. Script is what is called a client-side scripting language: a programming language that runs inside an Internet browser (a browser is also known as a Web client because it connects to a Web server to download pages) Inside a normal Web page you place some Java. Script code. When the browser loads the page, the browser has a built-in interpreter that reads the Java. Script code it finds in the page and runs it.

Possible Usage Web page designers use Java. Script in many different ways: One of

Possible Usage Web page designers use Java. Script in many different ways: One of the most common is to do field validation in a form. Many Web sites gather information from users in online forms, and Java. Script can help validate entries. For example, the programmer might validate that a person's age entered into a form falls between 1 and 120. Another way that web page designers use Java. Script is to create calculators.

Simple Calculator (1) The HTML below shows you how to create a Fahrenheit to

Simple Calculator (1) The HTML below shows you how to create a Fahrenheit to Celsius converter using Java. Script: <HEAD> <SCRIPT> function temp(form) { var f = parse. Float(form. Deg. F. value, 10); var c = 0; c = (f - 32. 0) * 5. 0 / 9. 0; form. Deg. C. value = c; } </SCRIPT> </HEAD>

Simple Calculator (2) In the body of the page there is a typical form:

Simple Calculator (2) In the body of the page there is a typical form: <FORM> <h 2>Fahrenheit to Celsius Converter</h 2> Enter a temperature in degrees F: <INPUT NAME="Deg. F" VALUE="0" MAXLENGTH="15" SIZE=15> <p> Click this button to calculate the temperature in degrees C: <INPUT NAME="calc" VALUE="Calculate" TYPE=BUTTON on. Click=temp(this. form)> <p> Temperature in degrees C is: <INPUT NAME="Deg. C" READONLY SIZE=15> </FORM>