"Click here to go to the class homepage."

"Click here to go to homework #2."
" Click here to see the source code for homework #2."

"Click here to go to homework #3"
"Click here to see the source code for homework #3."

"Click here to go to homework #4, part 1"
"Click here to go to homework #4, part 2"

"Click here to see the source code for homework #4."


"Click here to go to homework #5." Note: item #0 of homework 5 is taken care of in my
homework #4a.


"Click here to see the source code for homework #5."


"Click here to go to Change-A-Curse, homework #6. (this is not the final project)."

"Click here to see the source code for homework #6 (not final proj.)."


"Click here to go to Change-A-Curse, homework #6. (this is not the final project)."

"Click here to go to the shopping cart form part of the final project (by Suzanne Stagel)."
"Click here to go to the customer info form part of the final project. (by Suzanne Malini)."
"Click here to see the source code for the Final Project. Server Side is by yours truly, Chris Balz."

===================================================== FINAL PROJECT source code. There are four main sections to this: the main perl script, the perl-cgi parsing script subroutine, the javascript/ html customer purchasing section, adn the javascript/ html customer data form entry section. ===================================================== #!/usr/local/bin/perl5 ## by Christopher M. Balz. ## Include the library file which contains ## the parsing routine. require "/home/fmrfreek/public_html/CGI/LIB/simpleParse.lib"; ## It would be good to implement some better security by ## only allowing data from known form submitters. ## Call the subroutine. &Parse_Form; ## Initialize any variables which need to be. $order = "We received your order. Thankyou from Synergy Seeds.\n"; $address = "none"; ## This section prints out each piece of data generated from ## the form or link. print "Content-type: text/html\n\n"; print "<H1><BLINK>The Almighty Server God Speaks:</BLINK></H1>"; $subjct = "Confirmation of order from Synergy Seeds.\n"; $from = "fmrfreek\@best.com\n"; foreach $key (sort keys(%formdata)) { $toHTML = "<P>The field named <B>$key</B> contained <B>$formdata{$key}</B>"; print $toHTML; $order .= "$key = $formdata{$key}\n"; if (( $key eq "email" ) || ( $key eq "EMAIL" )) { $address = $formdata{$key}; $address .= "\n"; } } $order .= "======================================"; print "<P> Final Order: $order"; print "<P> Final Address: $address"; ## Open and append to customer record file. open (CUSTORDERS, ">>/home/fmrfreek/public_html/CGI/LOGS/syngsdsorders.txt"); ## flock file to protect against lost update and ## other damage from simultaneous use. flock (CUSTORDERS, 2); print CUSTORDERS "$order"; close (CUSTORDERS); flock (CUSTORDERS, 8); ## Release hold on file. if ($address ne "none") { ## Send email confirmation containing order info. open (MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $address From: $from"; print MAIL "Subject: $subjct"; print MAIL "$order"; close (MAIL); } print "<P>Thank you for your order.</P>"; ================================================= Final Project source code, continued: server-side form data parsing subroutine: ================================================= sub Parse_Form { ## This subroutine parses form input. ## It also displays the parsed form data. ## It displays versatility and has security ## provisions. ## This parsing script was sourced from the ## book, PERL and CGI for the World Wide Web: Visual ## QuickStart Guide (Peachpit Press : Berkeley, CA), ## 1999. web reference: http://www.cookwood.com ## It has been modified in several significant ## ways by Christopher M. Balz. ## All commenting is by Christopher M. Balz. ## The first task is to load the @pairs array. ## How it loaded depends on which method (METHOD) ## was used to upload it from the browser to this ## server script. We use the environment variable ## REQUEST_METHOD to see what the method used is. ## Environment variables are stored in a hash named ## $ENV{'AN_ENVIRONMENTVARIABLE'}. if ($ENV{'REQUEST_METHOD'} eq 'GET') { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { ## With the POST method, we must first read the ## data from the standard input. To do this, we ## must specify the length of the data in bytes. ## This number is stored in the environment ## variable CONTENT_LENGTH. $buffer is just a ## temporary holding spot variable. read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); ## Next, we can split the data as before with ## the GET method: @pairs = split(/&/, $buffer); ## Check the QUERY_STRING environment variable ## to see if any data has been appended to the ## URL in addition to the data sent with the ## POST method: if ($ENV{'QUERY_STRING'}) { @getpairs = split (/&/, $ENV{'QUERY_STRING'}); ## Add the @getpairs array to the end of @pairs. push(@pairs, @getpairs); } } ## At this point, we know that neither ## GET nor POST has been used. else { ## Direct the output to the browser: print "Content-type: text/html\n\n"; ## Write the HTML to the browser: print "<P>Error: Must use POST or GET."; } ## This section processes the data in the @pairs array. ## The data from @pairs is loaded into a hash named ## $formdata{$key}. Thus, the $formdata hash is a ## hash of name-value pairs. foreach $pair (@pairs) ## Steps through the @pairs array, ## element by element. { ## The form's NAME=VALUE pair goes into $key and $value, ## respectively. ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; ## Replace + signs with spaces. ## Here we convert the hexadecimal representation of $key into ## ASCII, to spell the NAME value. $key =~ s/%(..)/pack("c", hex($1))/eg; $value =~ tr/+/ /; ## Replace + signs with spaces. ## Here we convert the hexadecimal representation of $value into ## ASCII, to spell the VALUE value. $value =~ s/%(..)/pack("c", hex($1))/eg; ## This eliminates any possible server side includes (SSI) from ## this (incoming) data, so that nothing unknown is executed ## (as a security precaution). $value =~ s/<!--(.|\n)*-->//g; ## This if conditional checks to see if the NAME (stored ## in the variable $formdata{$key}) has been already been ## assigned to the hash - perhaps because it has multiple ## values, like a menu or a set of checkboxes. if ($formdata{$key}) { ## If so, add the VALUE to any existing VALUES that ## correspond to the NAME in question. $formdata {$key} .= ", $value"; } else { $formdata{$key} = $value; } } ## End of foreach loop. ## End of parsing sequence. } 1; ## Must return true to be called successfully from the main script. ===================================================== Here is the purchasing and order formulation section of the ecommerce site: (final project), followed by ere is the customer data form section of the ecommerce site: (final project) ===================================================== ======================================================= ======================================================= //Shopping cart library functions //Suzanne Stagel //Foothill College-Summer 1999 //COIN 70-JavaScript //----------------- //Global Variables //----------------- var today = new Date(); var exp = new Date(); //Define cookie expiration exp.setTime(today.getTime() + 1000*60*60*24*365); //--------- //getCookie //--------- // //Parameters: name of the cookie to retrieve //Functionality: returns the value of the cookie with the specified name // function getCookie(Name) { var search = Name + "="; if (document.cookie.length > 0) { //if there are any cookies offset = document.cookie.indexOf(search) if (offset != -1) { // if cookie exists offset += search.length; //set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(offset, end)); } } } //------------------ //initializeCookies //------------------ // //Parameters: None //Functionality: initializes cookie value for each product to 0 and sets the cookies // on the user's machine // //Note: A maximum of 20 distinct products can be accomodated in the shopping cart // because this implementation is limited by the number of cookies that a // browser will allow a domain to set (this includes items added and later deleted // from the cart) // // Alert statements that are commented out are for debugging purposes only. // function initializeCookies() { //Variables var cookieValue = -1; var defaultQty = 0; //Define cookie expiration var today = new Date(); var exp = new Date(); exp.setTime(today.getTime() + 1000*60*60*24*365); // //Set initial cookies for Tomatoes // cookieValue = getCookie("brandywine"); if ( cookieValue != null ) { // alert("Cookie brandywine exists, original value: " + cookieValue); } else { setCookie("brandywine",defaultQty,exp); // alert("New cookie brandywine added with value of value: " + getCookie("brandywine")); } cookieValue = getCookie("earlyGirl"); if ( cookieValue != null ) { // alert("Cookie earlyGirl exists, original value: " + cookieValue); } else { setCookie("earlyGirl",defaultQty,exp); // alert("New cookie earlyGirl added with value of value: " + getCookie("earlyGirl")); } cookieValue = getCookie("cherokeePurple"); if ( cookieValue != null ) { // alert("Cookie cherokeePurple exists, original value: " + cookieValue); } else { setCookie("cherokeePurple",defaultQty,exp); // alert("New cookie cherokeePurple added with value of value: " + getCookie("cherokeePurple")); } cookieValue = getCookie("chadwickCherry"); if ( cookieValue != null ) { // alert("Cookie chadwickCherry exists, original value: " + cookieValue); } else { setCookie("chadwickCherry",defaultQty,exp); // alert("New cookie chadwickCherry added with value of value: " + getCookie("chadwickCherry")); } // //Set initial cookies for Watermelons // cookieValue = getCookie("yellowMoon"); if ( cookieValue != null ) { // alert("Cookie yellowMoon exists, original value: " + cookieValue); } else { setCookie("yellowMoon",defaultQty,exp); // alert("New cookie yellowMoon added with value of value: " + getCookie("yellowMoon")); } cookieValue = getCookie("moonbeam"); if ( cookieValue != null ) { // alert("Cookie moonbeam exists, original value: " + cookieValue); } else { setCookie("moonbeam",defaultQty,exp); // alert("New cookie moonbeam added with value of value: " + getCookie("moonbeam")); } // //Set initial cookies for Veggies // cookieValue = getCookie("carrot"); if ( cookieValue != null ) { // alert("Cookie carrot exists, original value: " + cookieValue); } else { setCookie("carrot",defaultQty,exp); // alert("New cookie carrot added with value of value: " + getCookie("carrot")); } cookieValue = getCookie("fourLettuce"); if ( cookieValue != null ) { // alert("Cookie fourLettuce exists, original value: " + cookieValue); } else { setCookie("fourLettuce",defaultQty,exp); // alert("New cookie fourLettuce added with value of value: " + getCookie("fourLettuce")); } cookieValue = getCookie("redLettuce"); if ( cookieValue != null ) { // alert("Cookie redLettuce exists, original value: " + cookieValue); } else { setCookie("redLettuce",defaultQty,exp); // alert("New cookie redLettuce added with value of value: " + getCookie("redLettuce")); } cookieValue = getCookie("peas"); if ( cookieValue != null ) { // alert("Cookie peas exists, original value: " + cookieValue); } else { setCookie("peas",defaultQty,exp); // alert("New cookie peas added with value of value: " + getCookie("peas")); } cookieValue = getCookie("peas"); if ( cookieValue != null ) { // alert("Cookie peas exists, original value: " + cookieValue); } else { setCookie("peas",defaultQty,exp); // alert("New cookie peas added with value of value: " + getCookie("peas")); } cookieValue = getCookie("corn"); if ( cookieValue != null ) { // alert("Cookie corn exists, original value: " + cookieValue); } else { setCookie("corn",defaultQty,exp); // alert("New cookie corn added with value of value: " + getCookie("corn")); } } //end initializeCookies //----------- //listCookies //----------- // //Parameters: None //Functionality: lists the values of all the cookies set by the site (in the form of dialog alert boxes) // //Note: This function is used for debugging purposes only. // function listCookies() { //Tomatoes alert("earlyGirl: " + getCookie("earlyGirl")); alert("brandywine: " + getCookie("brandywine")); alert("cherokeePurple: " + getCookie("cherokeePurple")); alert("chadwickCherry: " + getCookie("chadwickCherry")); //Watermelons alert("yellowMoon: " + getCookie("yellowMoon")); alert("moonbeam: " + getCookie("moonbeam")); //Veggies alert("carrot: " + getCookie("carrot")); alert("fourLettuce: " + getCookie("fourLettuce")); alert("redLettuce: " + getCookie("redLettuce")); alert("peas: " + getCookie("peas")); alert("corn: " + getCookie("corn")); alert("listCookies completed"); } //end listCookies //--------- //setCookie //--------- // //Parameters: name (of the cookie), value (of the cookie), expiration date of the cookie (optional) //Functionality: Sets a cookie on the user's machine. // function setCookie(name, value, expire) { document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) } //setCookie //--------- //addToCart //--------- // //Parameters: item (name of the cookie) //Functionality: "adds" the item to the shopping cart by incrementing the value of the cookie // by 1 and calling the updateCart() function to dynamically update the cartFrame's HTML // //Note: Alert statements that are commented out are for debugging purposes only. // function addToCart(item) { var cookieName = item; var cookieValue = -1; var newQuantity = 0; //check for existing cookie for this item //if exists, overwrite (adding 1), otherwise create cookie with value of 1 cookieValue = getCookie(item); if ( cookieValue != null ) { // alert(item + "cookie exists, original value: " + cookieValue); newQuantity = Number(cookieValue) + 1; } else { newQuantity = 1; } setCookie(item,newQuantity,exp); //For debugging only // cookieValue = getCookie(item); // alert("New cookie value for " + item + " is: " + cookieValue); //update shopping cart display updateCart(); } //addToCart //---------- //deleteItem //---------- // //Parameters: item (name of the cookie) //Functionality: "deletes" the item from the shopping cart by setting the value of the cookie // to 0 and calling the updateCart() function to dynamically update the cartFrame's HTML // //Note: Alert statements that are commented out are for debugging purposes only. // function deleteItem(item) { var cookieName = item; var cookieValue = -1; var newQuantity = 0; cookieValue = getCookie(item); if ( cookieValue != null ) { //For debugging only // alert("Deleting existing item " + item + " with a quantity of " + cookieValue + " from cart"); } else { alert("Error in deleteItem(): Trying to delete an item not in the shopping cart"); } setCookie(item,newQuantity,exp); //update shopping cart display updateCart(); //For debugging only // alert(item + " value is now " + getCookie(item)); } //deleteItem //----------- //subtractOne //----------- // //Parameters: item (name of the cookie) //Functionality: subtracts one "item" from the shopping cart by decrementing the value of the cookie // by 1 and calling the updateCart() function to dynamically update the cartFrame's HTML // //Note: Alert statements that are commented out are for debugging purposes only. // function subtractOne(item) { var cookieName = item; var cookieValue = 0; var newQuantity = 0; //check for existing cookie for this item //if exists, overwrite (subtracting 1), otherwise display error alert cookieValue = getCookie(item); if ( cookieValue != null ) { if (cookieValue > 0) { // alert(item + "cookie exists, original value: " + cookieValue); //For debugging only newQuantity = Number(cookieValue) - 1; setCookie(item,newQuantity,exp); } else { alert("Error in subtractOne(): Trying to subtract from an item with a quantity <= 0"); } } else { alert("Error in subtractOne(): Trying to subtract from an item not in the shopping cart"); } //For debugging only // cookieValue = getCookie(item); // alert("New cookie value for " + item + " is: " + cookieValue); //update shopping cart display updateCart(); } //subtractOne //--------------- //updateQuantity //--------------- // //Parameters: item (name of the cookie), quantity (new quantity in shopping cart) //Functionality: updates the quantity of "item" in the shopping cart by setting // its value to "quantity" and calling the updateCart() function to dynamically update the cartFrame's HTML // //Note: Alert statements that are commented out are for debugging purposes only. // function updateQuantity(item,quantity) { var cookieName = item; var cookieValue = 0; //check for existing cookie for this item //if exists, overwrite (with quantity passed in), otherwise display error alert cookieValue = getCookie(item); if ( cookieValue != null ) { // alert(item + "cookie exists, original value: " + cookieValue); //For debugging only newQuantity = quantity; setCookie(item,quantity,exp); } else { alert("Error in updateQuantity(): Trying to update from an item not in the shopping cart"); } //For debugging only // cookieValue = getCookie(item); // alert("New cookie value for " + item + " is: " + cookieValue); //update shopping cart display updateCart(); } //updateQuantity //---------- //updateCart //---------- // //Parameters: None //Functionality: dynamically creates new HTML for cartFrame based on the cookie values set // for each product. // //Note: Alert statements that are commented out are for debugging purposes only. // function updateCart() { var cartHTML="<H1>Error in updateCart()</H1>"; var beginCartHTML; //contains the initial section of HTML for the cart frame var endCartHTML; //contains the initial section of HTML for the cart frame var midCartHTML = ""; //contains the HTML with the individual products and quantites var s1 = "<SCRIPT language='JavaScript' src='javascript/cart.html'>"; //used to try to overcome the var s2 = "</SCRIPT>"; //problem with the SCRIPT tags being stripped out var rowHTML = ""; var cookieValue = 0; var totalHTML = "$0.00"; var orderTotal = 0.00; beginCartHTML = "<HTML>" + s1 + s2 + " <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> \ <TITLE>Shopping Cart \ </TITLE>" + s1 + s2 + "<LINK rel='stylesheet' type='text/css' href='style.html'>\ <STYLE></STYLE>\ </HEAD>\ <BODY text='yellow' link='#215E21' vlink='black'><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <center> <br> <div style="height:5px"></div> </center> \ <CENTER><H3>Shopping Cart</H3></CENTER>\ <FORM name='cart' method='POST' action='http://www.best.com/~fmrfreek/CGI/synergSeeds.cgi' onSubmit='return validate(cart)'>\ <TABLE cols=5>"; endCartHTML= "<CENTER><INPUT type=submit value='Checkout'></CENTER>\ </FORM>\ </BODY>\ <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML>"; // //Tomatoes // //brandywine cookieValue = getCookie("brandywine"); orderTotal = orderTotal + (cookieValue * 1.79); name = "brandywine"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='brandywine' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Brandywine tomatoes</TD>\ <TD>$1.79 each</TD>\ <TD><INPUT type=button value=' + ' onClick='parent.frames[1].addToCart(\"brandywine\")'></TD>\ <TD><INPUT type=button value=' - ' onClick='parent.frames[1].subtractOne(\"brandywine\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"brandywine\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = rowHTML; } //end if //earlyGirl cookieValue = getCookie("earlyGirl"); orderTotal = orderTotal + (cookieValue * .99); name = "earlyGirl"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='earlyGirl' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Early Girl tomatoes</TD>\ <TD>$.99 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"earlyGirl\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"earlyGirl\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"earlyGirl\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //cherokeePurple cookieValue = getCookie("cherokeePurple"); orderTotal = orderTotal + (cookieValue * 1.99); name = "cherokeePurple"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='cherokeePurple' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Cherokee Purple tomatoes</TD>\ <TD>$1.99 each</TD>\ <TD><INPUT type=button name= 'plus' value=' + ' onClick='parent.frames[1].addToCart(\"cherokeePurple\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"cherokeePurple\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"cherokeePurple\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //chadwickCherry cookieValue = getCookie("chadwickCherry"); orderTotal = orderTotal + (cookieValue * 1.29); name = "chadwickCherry"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='chadwickCherry' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Chadwick Cherry tomatoes</TD>\ <TD>$1.29 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"chadwickCherry\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"chadwickCherry\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"chadwickCherry\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if // //Watermelons // //yellowMoon cookieValue = getCookie("yellowMoon"); orderTotal = orderTotal + (cookieValue * 1.89); name = "yellowMoon"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='yellowMoon' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Yellow Moon watermelons</TD>\ <TD>$1.89 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"yellowMoon\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"yellowMoon\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"yellowMoon\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //moonbeam cookieValue = getCookie("moonbeam"); orderTotal = orderTotal + (cookieValue * 1.19); name = "moonbeam"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='moonbeam' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Moonbeam watermelons</TD>\ <TD>$1.19 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"moonbeam\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"moonbeam\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"moonbeam\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if // //Vegetables // //carrot cookieValue = getCookie("carrot"); orderTotal = orderTotal + (cookieValue * .79); name = "carrot"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='carrot' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Scarlet Nantes carrots</TD>\ <TD>$.79 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"carrot\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"carrot\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"carrot\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //fourLettuce cookieValue = getCookie("fourLettuce"); orderTotal = orderTotal + (cookieValue * 1.49); name = "fourLettuce"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='fourLettuce' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Four Seasons lettuce</TD>\ <TD>$1.49 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"fourLettuce\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"fourLettuce\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"fourLettuce\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //redLettuce cookieValue = getCookie("redLettuce"); orderTotal = orderTotal + (cookieValue * 1.89); name = "redLettuce"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='redLettuce' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Ruben's Red lettuce</TD>\ <TD>$1.89 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"redLettuce\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"redLettuce\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"redLettuce\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //peas cookieValue = getCookie("peas"); orderTotal = orderTotal + (cookieValue * 1.29); name = "peas"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='peas' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>unSnap peas</TD>\ <TD>$1.29 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"peas\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"peas\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"peas\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if //corn cookieValue = getCookie("corn"); orderTotal = orderTotal + (cookieValue * .69); name = "corn"; if ( (cookieValue != null) && (cookieValue > 0) ) { rowHTML = "<TR><TD><INPUT type=text name='corn' value=" + cookieValue + " size=3 onChange='parent.frames[1].updateQuantity(this.name,this.value)'></TD>\ <TD>Golden Bantam corn</TD>\ <TD>$.69 each</TD>\ <TD><INPUT type=button name='plus' value=' + ' onClick='parent.frames[1].addToCart(\"corn\")'></TD>\ <TD><INPUT type=button name='minus' value=' - ' onClick='parent.frames[1].subtractOne(\"corn\")'></TD>\ <TD><A HREF='javascript:parent.frames[1].deleteItem(\"corn\");'><IMAGE SRC='trash.html'</A></TD>\ </TR>" midCartHTML = midCartHTML + rowHTML; } //end if "<CENTER>Total $<INPUT type=text value=formatNumber(orderTotal,2)></CENTER>" totalHTML = "<BR><CENTER>Total $" + formatNumber(orderTotal,2) + "</CENTER><BR>"; // //Define the full contents of the shopping cart HTML frame and reload the frame // cartHTML = beginCartHTML + midCartHTML + "</TABLE>" + totalHTML + endCartHTML; //For debugging only // alert(cartHTML); parent.frames.cartFrame.document.writeln(cartHTML); parent.frames.cartFrame.document.close(); parent.frames.frames[1].focus(); } //updateCart //------------ //formatNumber //------------ // //Parameters: expr (floating point number), decplaces (number of decimal places to display) //Functionality: returns the specified floating point with the specified number of decimal places // function formatNumber(expr,decplaces) { var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces)); while (str.length <= decplaces) { str = "0" + str; } var decpoint = str.length - decplaces; return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length); } //formatNumber //-------- //checkout //-------- // //Parameters: None. //Functionality: opens the payments page (customer.html) // //Note: This function is not used. // function checkout() { } //checkout //------------ //resetCookies //------------ // //Parameters: None. //Functionality: resets cookie values for each product to 0 // function resetCookies() { var defaultQty = 0; //Define cookie expiration var today = new Date(); var exp = new Date(); exp.setTime(today.getTime() + 1000*60*60*24*365); setCookie("brandywine",defaultQty,exp); setCookie("earlyGirl",defaultQty,exp); setCookie("cherokeePurple",defaultQty,exp); setCookie("chadwickCherry",defaultQty,exp); setCookie("yellowMoon",defaultQty,exp); setCookie("moonbeam",defaultQty,exp); setCookie("carrot",defaultQty,exp); setCookie("fourLettuce",defaultQty,exp); setCookie("redLettuce",defaultQty,exp); setCookie("peas",defaultQty,exp); setCookie("peas",defaultQty,exp); setCookie("corn",defaultQty,exp); } //resetCookies =============================================================== =============================================================== <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <TITLE>Shopping Cart </TITLE> <SCRIPT language="JavaScript" src="javascript/cart.html"> </SCRIPT> <LINK rel='stylesheet' type='text/css' href='style.html'> <STYLE></STYLE> </HEAD> <BODY text="yellow" link="#215E21" vlink="black"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ================================================================ ================================================================ ==================================================================== ==================================================================== <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <LINK rel='stylesheet' type='text/css' href='style.html'> <STYLE></STYLE> <SCRIPT language="JavaScript" src="javascript/cart.html"> </SCRIPT> <SCRIPT> //global variable for error flag var errfound = false; //function to validate by length function ValidLength(item, len) { return (item.length >= len); } //function to validate an email address function ValidEmail(item) { if (!ValidLength(item, 5)) return false; if (item.indexOf ('@', 0) == -1) return false; return true; } // display an error alert function error(elem, text) { // abort if we already found an error if (errfound) return; window.alert(text); elem.select(); elem.focus(); errfound = true; } // main validation function function Validate() { errfound = false; if (!ValidLength(document.TheForm.username.value,6)) error(document.TheForm.username,"Invalid Name"); if (!ValidLength(document.TheForm.phone.value,10)) error(document.TheForm.phone,"Invalid phone number"); if (!ValidEmail(document.TheForm.email.value)) error(document.TheForm.email, "Invalid Email Address"); if (!ValidLength(document.TheForm.address.value,10)) error(document.TheForm.address, "Invalid Mailing Address"); if (!ValidLength(document.TheForm.city.value,15)) error(document.TheForm.city, "Invalid City/State/Zip"); return !errfound; /* true if there are no errors */ } </SCRIPT> </HEAD> <BODY text="yellow" link="#215E21" vlink="black"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <CENTER><H1>CUSTOMER ORDER FORM</H1> <P> </CENTER> <P> As you fill out the form below, appropriate calculations will be made. Please take care to check over the form when you are complete, so as to avoid any mistakes. Thank you! <P><HR> <FORM NAME="TheForm" METHOD="POST" ACTION="http://www.best.com/~fmrfreek/CGI/synergSeeds.cgi" onSubmit="return Validate(this.form)"> <H3>Shipping Address</H3> <CENTER> <TABLE border=0 cellpadding=2> <TR><TD align=RIGHT>Name:</TD> <TD><INPUT TYPE=TEXT NAME="username" VALUE="MALINI"size=45> </TD></TR> <TR><TD align=RIGHT>Address:</TD> <TD><INPUT TYPE=TEXT NAME="Address" VALUE="1200 XYZ AVE" size=60><BR><INPUT NAME="Address" size=60></TD></TR> <TR><TD align=RIGHT>City:</TD> <TD><INPUT TYPE=TEXT NAME="city" VALUE="SANTA CLARA" size=25> State: <INPUT TYPE=TEXT NAME="state" VALUE="CA" size=2> Zip Code: <INPUT TYPE=TEXT NAME="zip" VALUE="95050" size=10></TD></TR> <TR><TD ALIGN=right>Day Phone:</TD> <TD><INPUT TYPE=TEXT NAME="phone" VALUE="(123)456 7890" SIZE=14> Fax: <INPUT TYPE=TEXT NAME="fax" VALUE="(123)456 7890" SIZE=14> Country: <INPUT TYPE=TEXT NAME="USA" SIZE=14 ></TD></TR> <TR><TD ALIGN=right>E-Mail:</TD> <TD><INPUT TYPE=TEXT NAME="email" VALUE="vmalini@yahoo.com" SIZE=60></TD></TR> </TABLE></CENTER><BR> <HR> <HR><H3>Method of Payment</H3> <DL><INPUT TYPE="RADIO" NAME="pay" VALUE="PAYNOW" CHECKED>Please use this credit card for payment: <DD><INPUT TYPE="RADIO" NAME="visa" VALUE="VISA" CHECKED>Visa <INPUT TYPE="RADIO" NAME="mast" VALUE="MAST">Master Card <DD>Card Number <INPUT TYPE=TEXT NAME="cardno" VALUE="123456789" size=20> Expiration Date <INPUT TYPE=TEXT NAME="expdate" VALUE="07-01-99" size=8></DL> <HR><P><CENTER><INPUT TYPE="SUBMIT" VALUE="Submit Order" onClick="resetCookies()"> <INPUT TYPE="RESET" VALUE="Clear Order Form (Reset)" onClick=ResetForm(this.form)></CENTER> </FORM> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ============================================================= ============================================================= <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <TITLE>Fruits </TITLE> <SCRIPT language="JavaScript" src="javascript/cart.html"> </SCRIPT> <LINK rel='stylesheet' type='text/css' href='style.html'> <STYLE></STYLE> </HEAD> <BODY text="yellow" link="#215E21" vlink="black"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <CENTER><H1>Fruits</H1></CENTER> <H2>Tomatoes</H2> <FORM name="tomatoes"> <TABLE cols=3 COL="600,100,30"> <TR> <TD> *Brandywine - favorite Amish variety, great taste </TD> <TD>$1.79 per packet </TD> <TD> <INPUT type=button name="brandywine" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> <TR> <TD> *Early Girl - America's early favorite (61 days) </TD> <TD>$.99 per packet </TD> <TD> <INPUT type=button name="earlyGirl" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> <TR> <TD> *Cherokee Purple - best taste, heirloom </TD> <TD>$1.99 per packet </TD> <TD> <INPUT type=button name="cherokeePurple" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> <TR> <TD> *Chadwick Cherry - top-tasting cherry tomato </TD> <TD>$1.29 per packet </TD> <TD> <INPUT type=button name="chadwickCherry" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> </TABLE> </FORM> <H2>Watermelons</H2> <FORM name="watermelons"> <TABLE cols=3 COL="600,100,30"> <TR> <TD> *Yellow Moon and Stars - orange flesh, best taste. </TD> <TD>$1.89 per packet </TD> <TD> <INPUT type=button name="yellowMoon" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> <TR> <TD> *Early Moonbeam - exhibits great modern genetics. </TD> <TD>$1.19 per packet </TD> <TD> <INPUT type=button name="moonbeam" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> </TABLE> </FORM> <BR> <BR> <H3><A HREF="TOC.html">Back to Main Product list</A></H3> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ========================================================================================================================================= <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <TITLE>Seeds Galore </TITLE> <SCRIPT language="JavaScript" src="javascript/cart.html"> </SCRIPT> <SCRIPT language="JavaScript"> initializeCookies(); </SCRIPT> </HEAD> <FRAMESET COLS="265,*"> <FRAME SRC="cart.html" name="cartFrame"> <FRAME SRC="TOC.html" name="productsFrame"> </FRAMESET> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ============================================================== ============================================================== <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <TITLE>Fruits </TITLE> <LINK rel='stylesheet' type='text/css' href='style.html'> <STYLE></STYLE> <SCRIPT language="JavaScript" src="javascript/cart.html"> </SCRIPT> </HEAD> <BODY text="yellow" link="#215E21" vlink="black"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <CENTER><H1>Vegetables</H1></CENTER> <H2>Carrots</H2> <FORM name="carrots"> <TABLE cols=3 COL="600,100,30"> <TR> <TD> *Scarlet Nantes - fave from this French town </TD> <TD>$.79 per packet </TD> <TD> <INPUT type=button name="carrot" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> </TABLE> </FORM> <H2>Lettuce</H2> <FORM name="lettuce"> <TABLE cols=3 COL="600,100,30"> <TR> <TD> *Four Seasons - a great for the beginner </TD> <TD>$1.49 per packet </TD> <TD> <INPUT type=button name="fourLettuce" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> <TR> <TD> *Ruben's Red Romain - deep red </TD> <TD>$1.89 per packet </TD> <TD> <INPUT type=button name="redLettuce" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> </TABLE> </FORM> <H2>Peas</H2> <FORM name="peas"> <TABLE cols=3 COL="600,100,30"> <TR> <TD> *unSnap Super Sugar - unparalleled sugar pea </TD> <TD>$1.29 per packet </TD> <TD> <INPUT type=button name="peas" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> </TABLE> </FORM> <H2>Sweet Corn</H2> <FORM name="corn"> <TABLE cols=3 COL="600,100,30"> <TR> <TD> *Golden Bantam - a great old-time fave </TD> <TD>$.69 per packet </TD> <TD> <INPUT type=button name="corn" value="Add to cart" onClick="addToCart(this.name)"> </TD> </TR> </TABLE> </FORM> <BR> <BR> <H3><A HREF="TOC.html">Back to Main Product list</A></H3> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ===================================================== =================================================== Source code for "Change-A-Cuss", Homework #6 =================================================== <HTML> <TITLE> Chris Balz's change-a-cuss page </TITLE> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <SCRIPT language="JavaScript"> <!-- function changeCussin () { var bigStrng = document.SantasTellinUY.beGood.value; var sanitized = ""; var anyLeft = ""; var cussWords = new Array(); var sendToSanta = new Array(); var numToCheck = 7; var numCusses = 0; var idex; var indx; /* Load array with words to replace. */ cussWords [0] = "shit"; cussWords [1] = "damn"; cussWords [2] = "fuck"; cussWords [3] = "bitch"; cussWords [4] = "goddamnit"; cussWords [5] = "damnit"; cussWords [6] = "motherfucker"; /* Remove return characters from textarea string. */ var pattern = new RegExp ("%0D%0A", "g"); pattern = bigStrng.replace (pattern, " "); /* Load sendToSanta array with all the cusswords. */ for (idex = 0; idex < numToCheck; idex++) { var upOrLowCuss = new RegExp (cussWords[idex], "i"); sendToSanta [idex] = bigStrng.match (upOrLowCuss) } /* Replace all the cusswords with "XXX". */ sanitized = bigStrng; for (idex = 0; idex < numToCheck; idex++) { var eraseCuss = new RegExp (cussWords[idex], "gi"); sanitized = sanitized.replace (eraseCuss, "XXX") } /* Here's the output section: */ document.write ("Here's the corrected text: <BR> \"" + sanitized + "\""); document.write ("<BR><BR> Here's the list of cusswords you wrote "); document.write ("that WE'RE SENDING TO <BR>"); document.write ("EITHER SANTA OR THE APPROPRIATE DEITY! <BR><BR>"); for (idex = 0; idex < numToCheck; idex++) { if (sendToSanta [idex]) { document.write (idex + ") " + (sendToSanta [idex]) + "<BR>" ); numCusses++; } } document.write ("<BR>"); if (numCusses > 0) { document.write ("<BR><BR> You have an apology to make!"); if (numCusses > 1) { document.write ("<BR> You are grounded for a week."); } } document.close(); } //--> </SCRIPT> </HEAD> <BODY BACKGROUND="#FF3366"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <FORM NAME = "SantasTellinUY" onSubmit="changeCussin ()"> <P> You better be good, you better not cry, Santa's tellin' you why: type something and if it has curse words in it, we're sending them to your parents who will report you to either Santa or the most appropriate deity offered by your family's faith. Go for it: </P> <BR> <TEXTAREA NAME="beGood" cols=50 rows=10> Remember, we're watching you. </TEXTAREA> <BR> <INPUT TYPE=submit VALUE="Send To Santa"> </FORM> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ================================================== Here is the source code for homework #5. It is in two html files. ================================================== <HTML> <TITLE> Homework #5 for JavaScript (COIN 70) 7/26/99 Student: Christopher Balz Instructor: Sam Brodkin </TITLE> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <SCRIPT language="JavaScript"> <!-- // Global variables. var visitorBook = new Array (10); var next = 0; var mesg = ""; var submtd = false; function showVisitor () { var output = "<TABLE BGCOLOR = #00FF99 BORDER = 3><TR><TD>Name: " + this.name; output += "</TD><TD> from " + this.region + "</TD></TR>"; output += "<TR><TD COLSPAN=2>Last Visited Site: " + this.date + "</TD></TR>"; output += "<TR><TD COLSPAN=2>Favorite Communities: " + this.fave1Community; output += " and " + this.fave2Community + "</TD></TR>"; output += "<TR><TD COLSPAN=2>Favorite Festival: " + this.faveFreekFest; output += "</TD></TR> <TR><TD COLSPAN=2>Gave site " + this.rateSite; output += " on a scale of 10.</TD></TR> <TR><TD COLSPAN=2> Email Address: "; output += this.email + "</TD></TR> </TABLE>"; return output; } function tally () { var index, fest1, fest2, rateSite, avgRating, socClss, region, perpel; var output; fest1 = 0; fest2 = 0; if (submtd) { for (index = 0; index < (next+1); index++) { if ( (this.fave1Community == visitorBook[index].fave1Community) || (this.fave1Community == visitorBook[index].fave2Community) ) { fest1 += 1; } } fest1 -= 1; // Account for comparing to the same person. if ((fest1 > 1) || (fest1 = 0)) { perpel = " people"; } else { perpel = " person" }; output = this.fave2Community + " was the favorite of " + fest1 + perpel + "."; } else // User has not submitted a form yet. { output = "You must first enter into the Visitors' Log."; } showResults.document.write (output); showResults.document.close(); } // End of tally method of the visitorEntry objects. function visitorEntry (name, email, date, fave1Community, fave2Community, faveFreekFest, rateSite, socialClass, ethnicity, region) { this.name = name; this.email = email; this.date = date; this.fave1Community = fave1Community; this.fave2Community = fave2Community; this.faveFreekFest = faveFreekFest; this.rateSite = rateSite; this.socialClass = socialClass; this.ethnicity = ethnicity; this.region = region; this.showVisitor = showVisitor; // A method. this.tally = tally; // A method. } function makeEntry (theFrm) { nom = theFrm.Name.value; comm = theFrm.Community.value; submtd = true; visitorBook[next] = new visitorEntry (nom, "x", "x", "x", comm, "x", "x", "x", "x", "x", "x"); output = visitorBook[next].showVisitor(); next++; showResults.document.write (output); showResults.document.close(); } function notifyTimes() { var allCookies = top.document.cookie; if (allCookies == "") { numberVisits = 0; } else { strNumVis = ""; var strNumVis = unescape (allCookies.substring(5,allCookies.length)); numberVisits = parseInt(strNumVis); numberVisits++; } mesg = "You or someone using your browser has visited this"; mesg += " site " + numberVisits + " time(s)." + "<BR>"; showResults.document.write (mesg); showResults.document.close (); var exp = new Date(); var inTwoYears = exp.getTime() + (730 * 24 * 60 * 60 * 1000); exp.setTime(inTwoYears); inTwoYears = exp.toGMTString(); // Update cookie file. cookMagic = "nVis=" + numberVisits + ";expires=" + inTwoYears; top.document.cookie = cookMagic; } function loadTheBook (theForm) { makeEntry (theForm); submtd = true; return submtd; } //--> </SCRIPT> </HEAD> <FRAMESET COLS="50%,50%" onLoad="notifyTimes()"> <FRAME NAME="FormFrame" SRC="frmfrm.html"> </FRAME> <FRAME NAME="showResults" SRC="javascript:''"> </FRAME> </FRAMESET> <BODY><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> =========================== here is the form frame html file: (homework 5, continued): =========================== <HTML> <BODY BGCOLOR="#33FF66"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <FONT COLOR = "#FF0066"> <H2><CENTER>Visitor Log</CENTER></H2> <FORM NAME= "Vistor_Log" onSubmit = "return parent.loadTheBook(this)"> Your Name: <INPUT TYPE = "text" NAME = "Name"> <BR> Favorite Community: <INPUT TYPE = "text" NAME = "Community"> <BR> <INPUT TYPE = "submit" VALUE = "Enter"> <INPUT TYPE = "reset" VALUE = "Reset"> </FORM> <FORM NAME="ControlButtons"> <BR> <INPUT TYPE="button" VALUE="Visitor Tallies" NAME="VTallie" onClick="parent.tally()"> </FORM> </FONT> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> </PRE> </A> <A NAME = "homework3"> <XMP> ============================================================== Here is the source code for homework #3. ============================================ <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <TITLE> Homework #3 for JavaScript (COIN 70) 7/12/99 Student: Christopher Balz Instructor: Sam Brodkin </TITLE> <SCRIPT LANGUAGE = "JavaScript"> <!--// var colorWindow = null; var simplePallette = new Array(7); /* Create our color object. */ function neatColors (name, hexValue) { this.name = name; this.hexValue = hexValue; } /* Assign names and colors. */ simplePallette[0] = new neatColors("lime", "#00FF00"); simplePallette[1] = new neatColors("medium Aquamarine", "#66CDAA"); simplePallette[2] = new neatColors("firebrick", "#B22222"); simplePallette[3] = new neatColors("chartreuse", "#7FFF00"); simplePallette[4] = new neatColors("darkorchid", "#9932CC"); simplePallette[5] = new neatColors("Chevy orange", "#FF6633"); simplePallette[6] = new neatColors("azure", "#0099FF"); simplePallette[7] = new neatColors("aliceblue", "#0066FF"); /* Open the new window which will receive the colors. */ function openWindow () { colorWindow = window.open ("", "theTarget", "WIDTH=5", "HEIGHT=5"); colorWindow.focus(); // Make sure that the window is not hidden. colorWindow.document.close(); } /* On selection of a value, change the color and display a comment in the textarea box. */ function changeNcomment (form) { /* Get the actual index # of the color selected from the pull-down menu form.colors. */ var i = form.colors.selectedIndex; var result = ""; var colorPicked = simplePallette [i].hexValue; /* Change the color of the window. */ colorWindow.document.write ("<HTML> <BODY BGCOLOR = " + colorPicked + "><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <H1>Here it is!</H1> </BODY> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML>"); colorWindow.document.close(); // Must close the window after writing to it. switch (i) { case 0: result = "key lime pie!" break; case 1: result = "Antigua, that Saint-Michel mystique . . . " break; case 2: result = "fire that brick!" break; case 3: result = "fussy chartreuse . . . " break; case 6: result = "FORGET THE NIGHT - LIVE WITH US IN FORESTS OF AZURE"; break; default: result = "That\'s differ\'nt!"; } form.output.value = result; } //--> </SCRIPT> </HEAD> <BODY onLoad = "document.forms[0].colors.onchange()"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <FORM NAME = "color"> <SCRIPT LANGUAGE = "JavaScript"> <!--// openWindow (); var selct = "\'colors\' "; // This is the name of the pull-down menu. // warning: 'colors' is hardcoded elsewhere. var createfrm = "Select a color"; createfrm += " for the little window: <SELECT NAME = "; createfrm += selct + " onChange = \'changeNcomment(this.form)\'>"; document.write (createfrm); createfrm = ""; // Start assembling next part of page and form //build pop-up list from array color names for (var c = 0; c < (simplePallette.length); c++) { createfrm += " <OPTION"; // option tags if (c == 0) // pre-select first item in list { createfrm += " SELECTED" } createfrm += "> " + simplePallette [c].name; } createfrm += "</SELECT> <P>"; // close selection item tag document.write (createfrm); // lay out this pull-down section //--> </SCRIPT> <!-- This is where we write our comments on the user's selection. --> <TEXTAREA NAME="output" ROWS=1 COLS=55> </TEXTAREA> </FORM> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> ================================================================== HERE IS THE SOURCE CODE FOR HOMEWORK #2 ================================================================== <HTML> <!-- ARCHIVE by FORTUNECITY.ws --> <HEAD> <TITLE>Homework for COIN 70, Javascript, for 7/7/99, student Christopher Balz.</TITLE> <SCRIPT LANGUAGE = JavaScript> <!-- var masterCount = 0; function tableify() /* This function is the master function for the JavaScript that powers this page. */ { var numTables = 1; /* The loop is tests false when numTables <= 4 because we do not want to prompt the user to continue after the fourth and final table. */ while (numTables <= 4) { document.write ("<BR> <H1> This is table #" + numTables + ": </H1>") /* Here is the function call that generates the table purely under JavaScript control. */ oneTo25(); /* This if block of code contains the user prompt of whether or not to continue. */ if (numTables < 4) { var ready = false; ready = confirm ("The next table (#" + (numTables+1) + ") of 25 numbers is coming up if you are ready."); if (ready == false) { document.write ("<FONT COLOR = #99FFFF> <H1> Bye then! </H1>"); break; } } numTables++; } /* The exiting message for the whole script. */ document.write ("<FONT COLOR = #00CCFF> <H1> That's all folks! </H1>"); } function oneTo25() /* This function uses JavaScript to dynamically generate and apply HTML and JavaScript code which displays a table of the numbers 1 - 25. */ { var counter = 1; /* Here HTML is accumulated in the tablSpecs variable, for greater legibility. */ var tablSpecs = "<TABLE BGCOLOR = #FF9900 BORDER = 7 RULES = 5"; tablSpecs += " CELLPADDING = 5 WIDTH = 50% HEIGHT = 50%>"; /* Here the table format is created and set for ensuing HTML and JavaScript code. */ document.write (tablSpecs); for (counter = 1; counter <= 25; counter++) { masterCount += 1; /* This if statement allows us to insert a row break every 5 numbers in the table. */ if ( (counter == 1) || (counter == 6) || (counter == 11) || (counter == 16) || (counter == 21) ) { var tableCode = "<TR> <TD> " } else { var tableCode = "<TD> " } /* Here the HTML and JavaScript code is loaded into the tableCode variable, which is the future argument to the document.write method. In other words, here we are not only feeding HTML into JavaScript via the .write method, but we are feeding JavaScript itself into JavaScript. This is how we accomplish incrementing the table data element counter within JavaScript and dynamically write the HTML (the table data cells) at the same time. */ tableCode += "<CENTER> <FONT COLOR = #33FF00> <H2>" /* This part with the document.write represents the core of this script exercise. */ tableCode += "<SCRIPT LANGUAGE = JavaScript> document.write ("; tableCode += masterCount; tableCode += "); </SCRIPT> </H2> </CENTER> </TD>"; /* If we are at the end of a row we must close the row in HTML. */ if ( (counter == 5) || (counter == 10) || (counter == 20) || (counter == 25) ) { tableCode += "</TR>" } /* Here we write the individual table data cell (TD) with the correct number contained within it. */ document.write(tableCode); } /* Here we are done with the table so we must close it in HTML. */ document.write("</TABLE>"); } //--> </SCRIPT> </HEAD> <BODY bgcolor = "#FF00AA"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <CENTER> <H3> <!-- This segment of HTML allows us to call the table creating function tableify(). --> <SCRIPT LANGUAGE = JavaScript> <!-- tableify(); //--> </SCRIPT> </H3> </CENTER> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML> -------------------------------------------------------- HOMEWORK #4 (part 1 of 2) FOR COIN 70 by student C. Balz -------------------------------------------------------- <html> <!-- ARCHIVE by FORTUNECITY.ws --> <head><script LANGUAGE="JavaScript"> function clearField(field) { // Check if field contains the default value if (field.value == field.defaultValue) { // It does, so clear the field field.value = ""; } } function checkField(field) { // Check if user has entered information in the field if (field.value == "") { // User has not entered anything field.value = field.defaultValue; } } function checkAgeField(field) { notInt = false; checkField(field); // Check if user has entered a correct age. // First, make sure that the user entered a // positive integer. for (var i = 0; i < field.value.length; i++) { var oneChar = field.value.charAt(i); if (oneChar < "0" || oneChar > "9") { notInt = true; } } if ( notInt || (field.value < 1) || (field.value > 121) ) { alert("You must enter an age between 1 and 121.") field.value = field.defaultValue; ok = false; document.freek.age.onfocus(); } else ok = true; return ok; } </script> <title>Week 4 Homework, Christopher Balz - 341.htm</title> </head> <body bgcolor="#FFFFFF"><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <p align="center"><strong><font color="#808080"><big><big><big><big>Week 4</big></big></big></big></font><br> <big>341.htm</big></strong></p> <div align="center"><center> <table border="0" width="95%" cellspacing="0" cellpadding="0"> <tr> <td width="100%" align="center"><form NAME = "freek", METHOD="POST"> <div align="center"><center><table border="2" cellpadding="5" bgcolor="#FAFAC8"> <tr> <td align="center"><input TYPE="text" NAME="name" VALUE="Name" onFocus="clearField(this);" onBlur="checkField(this);" size="20"></td> </tr> <tr> <td align="center"><input TYPE="text" NAME="email" VALUE="E-mail Address" onFocus="clearField(this);" onBlur="checkField(this);" size="20"></td> </tr> <tr> <td align="center"><input TYPE="text" NAME="age" VALUE="Your Age" onFocus="clearField(this);" onBlur="return checkAgeField(this);" size="20"></td> </tr> </table> </center></div> </form> </td> </tr> </table> </center></div> </body> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </html> -------------------------------------------------- HOMEWORK #4, part 2, COIN 70 Christopher Balz. -------------------------------------------------- <html> <!-- ARCHIVE by FORTUNECITY.ws --> <head> <title>Homework #4, part 2, Christopher Balz, - Exponent Calculator</title> <meta name="GENERATOR" content="Microsoft FrontPage 3.0"> <SCRIPT LANGUAGE = "JavaScript"> <!-- function power (x, exp) { answr = Math.pow (x, exp); return answr; } //--> </SCRIPT> </head> <body><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-47423994-1', 'fortunecity.ws'); ga('send', 'pageview'); </script> <center> <br> <div> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=728&height=90"></script> </div> </center> <!-- FC HP BN1 START --> <!-- Please do not remove the line above or the code within this section --> <!-- Doing so may cause damage to your pages or insertion of multiple banners--> <center><p> <table border="0" cellspacing="0" cellpadding="0"> <tr><td colspan="11"><img src="http://www.fortunecity.com/console2/newnav/top.gif" height="7" width="555"></td></tr> <tr><td><img src="http://www.fortunecity.com/console2/newnav/left.gif" alt="FC Navigation Console" height="60" width="72" border="0" usemap="#fcleft"><map name="fcleft"><area shape="rect" coords="10,43,64,60" href="http://www2.fortunecity.com/cgi-bin/homepage/estate.pl?referer=navbar" target="_top"><area shape="rect" coords="9,21,61,36" href="http://www2.fortunecity.com/cgi-bin/showarea.pl?area=oasis&amp;referer=navbar" target="_top"><area shape="rect" coords="8,0,62,15" href="http://www.fortunecity.com/" target="_top"><area shape="rect" href="http://www.fortunecity.com/" target="_top" coords="0,0,49,49"></map></td><td colspan="9"><A HREF="http://ad.doubleclick.net/jump/fc.us468/member/travel;s1=m;s3=trav;pos=1;tag=g;sz=468x60;mtile=1;num=7949?"><IMG SRC="http://ad.doubleclick.net/ad/fc.us468/member/travel;s1=m;s3=trav;pos=1;tag=g;sz=468x60;mtile=1;num=7949?" border=0 height="60" width="468"></A></td> <td><img src="http://www.fortunecity.com/console2/newnav/right.gif" width="15" height="60"></td></tr> <tr><td><img src="http://www.fortunecity.com/console2/newnav/left2.gif" height="31" width="72" target="_top"></td><td><img src="http://www.fortunecity.com/console2/newnav/gap1.gif" width="17" height="31"></td><td><a href="http://adex3.flycast.com/server/socket/127.0.0.1:2800/click/FortuneCitycom/NavBar1/7949" target="_top"><img src="http://adex3.flycast.com/server/socket/127.0.0.1:2800/ad/FortuneCitycom/NavBar1/7949" border="0" width="88" height="31"></a></td><td><img src="http://www.fortunecity.com/console2/newnav/gap2.gif" width="24" height="31"></td><td><a href="http://adex3.flycast.com/server/socket/127.0.0.1:2800/click/FortuneCitycom/NavBar2/7949" target="_top"><img src="http://adex3.flycast.com/server/socket/127.0.0.1:2800/ad/FortuneCitycom/NavBar2/7949" border="0" width="88" height="31"></a></td><td><img src="http://www.fortunecity.com/console2/newnav/gap3.gif" width="24" height="31"></td><td><a href="http://adex3.flycast.com/server/socket/127.0.0.1:2800/click/FortuneCitycom/NavBar3/7949" target="_top"><img src="http://adex3.flycast.com/server/socket/127.0.0.1:2800/ad/FortuneCitycom/NavBar3/7949" border="0" width="88" height="31"></a></td><td><img src="http://www.fortunecity.com/console2/newnav/gap4.gif" width="19" height="31"></td><td><a href="http://www2.fortunecity.com/cgi-bin/homepage/navbarforward.cgi?from=nav4&amp;referer=navbare" target="_top"><img src="http://www.fortunecity.com/console2/newnav/button4.gif" border="0" width="88" height="31"></a></td><td><img src="http://www.fortunecity.com/console2/newnav/gap5.gif" width="32" height="31"></td><td><img src="http://www.fortunecity.com/console2/newnav/right2.gif" width="15" height="31"></td></tr></table></p> </center> <!-- WARNING: under no circumstances remove the line below. Doing so may damage your page.--> <!-- FC HP BN1 END --> <form align="center"> <table border="0" cellpadding="0" cellspacing="0" width="95%"> <tr> <td width="100%"><div align="center"><center><p><strong><big><big><big><big><font color="#808080">Week 4</font></big></big></big></big><br> 342.htm</strong></p> </center></div><div align="center"><center><table border="2" cellpadding="10" bgcolor="#FAFAC8"> <tr> <td width="100%" colspan="2" bgcolor="#000080"><div align="center"><center><p><strong><big><font color="#FAFAC8">Exponent Calculator</font></big></strong></td> </tr> <tr align="center"> <td width="50%"><font color="#0000FF"><b>X:</b> </font></td> <td width="50%"><input TYPE="text" NAME="x" value="1" onChange="this.form.answer.value=power(form.x.value,form.y.value);" size="10"></td> </tr> <tr align="center"> <td width="50%"><font color="#0000FF"><b>Y:</b></font></td> <td width="50%"><input TYPE="text" NAME="y" value="1" onChange="this.form.answer.value=power(form.x.value,form.y.value);" size="10"></td> </tr> <tr align="center"> <td width="50%"><font color="#0000FF"><b>X^Y:</b></font></td> <td width="50%"><input TYPE="text" NAME="answer" value=this.form.answer.value size="10"></td> </tr> </table> </center></div></td> </tr> </table> </form> </body> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </html> </PRE> </A> </BODY> <!-- ARCHIVE by FORTUNECITY.ws --> <center> <div> <br> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250&cache=0"></script> <script language="javascript" type="text/javascript" src="http://ad.broadcaststation.net/ads/show_ad.php?width=300&height=250"></script> </div> <br> <br> </center> </HTML>