JScript Sample: jscript/ado/animals/animals.asp
   ASP Script
   Comments or Client-side Script
   HTML and Text

<%@ Language=JavaScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
dbms = Request.QueryString("dbms");
RS = Session("animalsRd");
direction = parseInt( Request.QueryString("direction") );
if ( RS.RecordCount > 0 ) {
   movecnt = parseInt( Request.QueryString("movecnt") );
   switch ( direction ) {
      case 1:
         RS.MoveFirst();
         movecnt = 1;
         break;
      case 2:
         if ( !RS.BOF ) {
            RS.MovePrevious();
            movecnt = parseInt(movecnt) - 1;
         }
         break;
      case 3:
         if ( !RS.EOF ) {
            RS.MoveNext();
            movecnt = parseInt(movecnt) + 1;
         }
         break;
      case 4:
         RS.MoveLast();
         movecnt = RS.RecordCount;
         break;
      default:
         RS.CancelUpdate();
   }

   // Error Handling
   if ( RS.EOF ) {
      movecnt = RS.RecordCount;
      RS.MoveLast();
   }

   if ( RS.BOF ) {
      movecnt = 1;
      RS.MoveFirst();
   }
} else {
   movecnt = 0;
}
%>

<FORM Method=post Name=form1>
<TABLE width=100%>
<%
   var fieldInfo = RS.Fields;
   for (i = 0; i < fieldInfo.Count - 1; i++) {
   var field = fieldInfo.Item(i);
%>

<TR><TD align=center width=40%><%=field.Name%>:</TD>
<TD width=60%>
<% if ( RS.EOF || RS.BOF ) { %>
<Input Type=Text name="Text<%=i%>" size=25>
<% } else {%>
<Input Type=Text name="Text<%=i%>" size=25 Value="<%=field.Value%>">
<% }%>
</TD></TR>
<%}%>
</TABLE>

<CENTER><P>
<input type=button name=MoveFirst value=" |< " onClick="MoveClick(1);">
<input type=button name=MovePrevious value=" < " onClick="MoveClick(2);">
<INPUT Type=button Name=absolute Value=" <%=movecnt%> of <%=RS.RecordCount%> ">
<input type=button name=MoveNext value=" > " onClick="MoveClick(3);">
<input type=button name=MoveLast value=" >| " onClick="MoveClick(4);">
<INPUT Type=button Name=AddNew value="Add" onclick="AddRecord()"></P>
</CENTER>
</FORM>

<%if (direction > 0) {%>
<SCRIPT language=javascript>
   parent.blob.location.reload();
</SCRIPT>

<%}%>
<hr size="1" color="#000000">
<EM>This is <%=dbms%> database.</EM>
<font size="+1">
<center><a href="selectdb.asp" target=main>
Return Home</a></center></font>
</BODY>

<SCRIPT Language="JavaScript">
function MoveClick(option) {
   document.form1.action = "animals.asp?dbms=<%=dbms%>&movecnt=<%=movecnt%>&direction=" + option;
   document.form1.submit();
}
function AddRecord(){
   document.form1.action = "register.asp?dbms=<%=dbms%>&movecnt=<%=movecnt%>&chggif=0";
   document.form1.target = "main";
   document.form1.submit();
}
</SCRIPT>

</HTML>


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.