CIS179 Web Script Programming
My Description of the course.
(This is not the official course description.)
3 Credit Hours
Prerequisite: General computer knowledge and familiarity with the
World Wide Web and web browsers.
Knowledge of HTML and programming is helpful but not required.
General Education Skill: problem solving
This course covers the creation of dynamic Web pages using popular
web scripting languages including JavaScript.
Students will build applications from the bottom up. Client side
and server side scripting will be explored.
The goal of this course is to create web pages that have dynamic
and/or interactive content.
Useful Links
javascript.internet.com
www.dynamicdrive.com
www.javascript.com
www.javascriptcity.com
www.javascripts.com
Netscape
page on JavaScript
Netscape
JavaScript indexl
Netscape's
JavaScript Debugger
This is a Java application that helps you debug your JavaScript code.
Examples
***** SCROLLING TEXT BOX *****
The following code displays a text box and two buttons. Click on the "Scroll"
button to start a message scrolling in the text box.
SOURCE CODE
<SCRIPT LANGAUGE="JavaScript1.2">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
var message = "Web Script programming is FUN :)";
var msgSpace = "...
";
var curChar = 0;
var curSpace = 0;
var startScrolling;
function scrollingMsg() {
document.msgForm.scrollingMsg.value =
message.substring(curChar,message.length)
+ msgSpace.substring(curSpace,msgSpace.length) +
message.substring(0,curChar);
curChar++;
if (curChar > message.length) {
curChar--;
curSpace++;
if (curSpace > msgSpace.length)
{
curChar = 0;
curSpace = 0;
}
}
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</SCRIPT>
<FORM NAME="msgForm">
<INPUT TYPE="text" NAME="scrollingMsg"><P>
<INPUT TYPE="button" NAME="scroll" VALUE=" Scroll "
onClick="startScrolling=setInterval('scrollingMsg()',100);">
<INPUT TYPE="button" NAME="stop" VALUE=" Stop "
onClick="clearInterval(startScrolling);">
</FORM>
Demo of Scrolling Text Box
***** PAGE HIT COUNTER *****
A simple page hit counter using server side JavaScript for Microsoft Internet
Information Server (MIIS).
Each time a user access counter.asp the page count will be incremented
by one. Note, this counter
prevents simple page reloads from incrementing the count.
SOURCE CODE
<%@ LANGUAGE=JScript %>
<HTML>
<HEAD>
<TITLE>Prof. Chuck Kelly (A.K.A. Prof of Borg) MCCC</TITLE>
<%
if (!Session.Contents("sameClient")) {
Application.Lock();
if (!Application.Contents("counter"))
Application.Contents("counter") = 1;
else {
Application.Contents("counter") = Application.Contents("counter")
+ 1;
}
Application.Unlock();
Session.Contents("sameClient") = "true";
}
%>
</HEAD>
<BODY>
<H2>Web Script Programming Demonstration Page</H2>
<H3>Welcome</H3>
<P>
This page demonstrates using JavaScript in an Active Server Page
to implement
a simple page counter. This counter uses environment variables
to maintain
the counter which means it may get reset to zero if the web server
is restarted.
<P>
<HR>
<B>Number of Borg drones assimilated to date is <%=Application.Contents("counter")%></B>
<HR>
</BODY>
</HTML>
Demo of page counter
Return to Prof Kelly
Last Updated
August 23, 2005