CECS 5100Survey of Educational Computer Languages
Fall 2002
|
||
|
Need a free MP3 Player to listen to these clips ?
<html>
<head>
<script language="JavaScript">
function showVar() {
alert(test)
}
function loadVar() {
test = "6"
}
loadVar(); // loads variable test with "6"
</script>
</head>
<body>
<form>
<input type="button" value="click" onClick="showVar()">
</form>
</body>
</html>
<html>
<head>
<script language="JavaScript">
schedulePage = "http://courseweb.tac.unt.edu/gjones/fall2002/cecs5100/schedule.html";
thisPage = "assignment1b.html";
function showConfirm ()
{
if ( confirm ( "Would you like to view the class schedule?" ) )
location = schedulePage;
else
location = thisPage;
}
</script>
</head>
<body>
Part 2: (5 pts)<br>
Using JavaScript within HTML write an html/script that implements
the following pseudo code.
<p>
a. Upon viewing the HTML page, display the course description
for 5100<br>
b. At the bottom/after the course description html, provide a
hyper-link to the schedule page on courseweb.unt.edu under 5100<br>
c. When the user clicks on the schedule hyper-link, the user
is presented with a confirm dialog box asking if they wish to
go to the new page or not.<br>
d. If the user presses Okay, then the page changes to the
listed URL for the schedule<br>
e. If the user presses Cancel, the page does not change.<br>
<p>
Test Data: None<br>
Output: HTML as described, confirm dialog displayed on click of HREF
for schedule, and page changes to the schedule page on confirm OK<br>
Expected Code: Student can use whatever JS code they wish to complete
the assignment.<br>
Note: An example for this half of the assignment might be found on
the current 5100 course pages. <br>Hint: Remember to 'view source'
when looking at a web page.
<p>
<hr>
<b><font color="#66007F"><font size=+1>Course Description:</font></font></b>
<ul>A study of beginning computer programming using JavaScript,
Perl, and HTML. Requires "hands-on" programming independent of
classroom instruction. Topics include variables, simple and complex
data structures, object-oriented design, debugging, and language uses.</ul>
<p>
<a href="#1" NAME="1" onClick="JavaScript:showConfirm()">View Course Schedule</a>
</body>
</html>
Example 1
<html>
<head>
<script language="JavaScript">
function readText(form) {
var TestVar = form.inputbox.value;
alert ("You typed: '" + TestVar + "'");
}
function writeText(form) {
form.inputbox.value = "Have a nice day!";
}
</script>
</head>
<body>
<b>Example on page 462</b>
<p>
<form name="myform" action=" " Method="Get">
Enter something in the box:
<Input type="text" name="inputbox" value="">
<p>
<input type="button" name="button1" value="Read" onClick="readText(this.form)">
<input type="button" name="button2" value="Write" onClick="writeText(this.form)">
</form>
</body>
</html>
Copyright 2002, Dr. James G Jones |
||