CSCI 4230.1
Internet Application Development
Summer 2001
Suggested Solution to Final Examination

(1)    (a)

1 2 5
10 4 30

(b)    For example:

.emph {
    font-family:Arial,Verdana;
    font-style:italic;
    background-color:#ccccff;
    border-style: solid;
    border-width: 1px 0px 1px 0px;
}

(c)    For example:

<html>
<head>
<script>
function swap(f) {
   var temp = f.txt1.value;
   f.txt1.value = f.txt2.value;
   f.txt2.value = temp;
}
</script>
</head>
<body>
<form>
Transporter #1:
<p>
Text #1: <input name="txt1" size="40">
<br>
Text #2: <input name="txt2" size="40">
<p>
<input type="button" value="Swap #1!"
       onClick="swap(this.form);">
</form>
<p>
<form>
Transporter #2:
<p>
Text #1: <input name="txt1" size="40">
<br>
Text #2: <input name="txt2" size="40">
<p>
<input type="button" value="Swap #2!"
       onClick="swap(this.form);">
</form>
</body>
</html>

(2)    For example,

<%  option explicit %>
<!--  Suggested Solution to Final Examination of CSCI 4230.1 Question 2, Summer 2001.
   No error handling.
-->
<html>
<head>
<title>Update Form
</title>
<body bgcolor="#ccccff">
<%
Dim DSN
DSN = "yuep"
' Get SSNum
Dim SSNum
SSNum = Request("SSNum")

'   Open database connection.
Dim conn
Set conn = Server.CreateObject("adodb.connection")
conn.open DSN
Dim sql
sql = "select LName, FName, Major from Sum01t2q2" & _
      " where SSNum = '" & Replace(SSNum, "'", "''") & "'"

'   Response.write "sql => " & sql & "<br>"
Dim result
set result = conn.execute(sql)
if (result.eof) then
 Response.write "<h2>Sorry, no record has a SSN that matches " & SSNum & ".</h2>"
 Response.End
end if
%>

<h2>Change values to update the record</h2>
<form action="update.asp" method="get">
<input type="hidden" name="SSNum" value="<% = SSNum %>">
<table>
<tr valign="top">
   <td>SS#</td>
   <td>&nbsp;&nbsp;&nbsp;<% = SSNum %></td>
</tr>
<tr valign="top">
   <td>Last Name:</td>
   <td>&nbsp;&nbsp;&nbsp;<input name="lname" value="<% = result.fields.item("LName") %>" size="30" maxlength="100"></td>
</tr>
<tr valign="top">
   <td>First Name:</td>
   <td>&nbsp;&nbsp;&nbsp;<input name="fname" value="<% = result.fields.item("FName") %>" size="30" maxlength="100"></td>
</tr>
<tr valign="top">
   <td>Major:</td>
   <td>&nbsp;&nbsp;&nbsp;<input name="major" value="<% = result.fields.item("Major") %>" size="30" maxlength="100"></td>
</tr>
</table>
<br>
<input type="submit" value="Update Record!">
</form>
</body>
</html>