JavaScript: CS 110 Fall 2007 Course Materials - Prof. David W. Wolber, Assignments of Computer Science

An introduction to javascript, a browser scripting language similar to java. It covers the history, uses, and basic syntax of javascript. The document also demonstrates how to create a confirm box using javascript and explains advanced uses such as manipulating the document object model (dom) and asynchronous javascript and xml (ajax).

Typology: Assignments

Pre 2010

Uploaded on 07/31/2009

koofers-user-vsi
koofers-user-vsi 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 110 Fall 2007
Javascript
The BROWSER scripting language.
Similar syntax to java.
History: Netscape created to allow dynamic web pages.
Uses: Many, here are a couple:
verifying and reacting to user input,
updating page without making user wait
Javascript tutorial: http://www.w3schools.com/js/js_intro.asp
Alert box sample:
http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm
<html>
<head>
<script type="text/javascript">
function disp_confirm()
{
var r=confirm("Press a button");
if (r==true)
{
document.write("You pressed OK!");
}
else
{
document.write("You pressed Cancel!");
}
}
</script>
</head>
<body>
<input type="button" onclick="disp_confirm()" value="Display
a confirm box" />
</body>
</html>
pf3

Partial preview of the text

Download JavaScript: CS 110 Fall 2007 Course Materials - Prof. David W. Wolber and more Assignments Computer Science in PDF only on Docsity!

Javascript

The BROWSER scripting language. Similar syntax to java. History: Netscape created to allow dynamic web pages. Uses: Many, here are a couple: verifying and reacting to user input, updating page without making user wait Javascript tutorial: http://www.w3schools.com/js/js_intro.asp Alert box sample: http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm

Can also put javascript in a file external to the html:

confirm.js: function disp_confirm() { var r=confirm("Press a button"); if (r==true) { document.write("You pressed OK!"); } else { document.write("You pressed Cancel!"); } } See sample at http://www.cs.usfca.edu/~wolber/jsSamples/confirm2.html