Home > Articles

  • Print
  • + Share This

<Script Language = JavaScript>

You read earlier that you can use JavaScript as your scripting language on both the server and client sides. If you want to use JavaScript as your programming language, set the Language attribute to JavaScript as shown in the first line of Listing 3.3.

Listing 3.3: Setting the Language Attribute to JavaScript (03asp03.htm)

<SCRIPT LANGUAGE=javascript>
function button1_onclick() {
  var r = text1.value;
  window.alert(r);
}
</SCRIPT>

Figure 3.3 shows the output of the code in Listing 3.3.

Figure 3.3 The scripting language you use is transparent to the user.

If you are familiar with the C or Java programming languages, you'll notice that the syntax of JavaScript is very similar to both. JavaScript uses the semicolon to indicate the end of a programming statement, curly brackets (also known as braces) to denote code blocks, and most importantly, JavaScript is case sensitive. When you use JavaScript you cannot use uppercase characters as you would use their lowercase equivalents.

The code in Listing 3.4, which is a variation of Listing 3.3, will not work. Notice in Listing 3.4, the line:

  window.alert(R);

The code in this particular line uses an uppercase R. Whereas in Listing 3.3, the working code uses a lowercase r. Remember that if you are going to use JavaScript always be aware that the language is case sensitive.

Listing 3.4: JavaScript is Case Sensitive (03asp04.htm)

<SCRIPT LANGUAGE=javascript>
function button1_onclick() {
  var r = text1.value;
  window.alert(R);
}
</SCRIPT>
  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.