Mixing Server-Side and Client-Side Scripts VB Help

An ASP rile can contain both server-side and client-side scripts. If you want to include a script section in your Web page, simply insert the scripting commands between the <SCRIPT> tags in the file. It shows the output of another ASP file that is a variation on the script that displays the server’s date on the client. The TlMESRVR.ASP page displays the time on the client through a client side script, and it displays the time on the server through a server-side script. If the client and server computers are in different time zones, the difference in the time is an integer number of hours, plus a few seconds that it may take for the HTML code to arrive. at the client.

Here is the listing of the TlMESRVR.ASP file. Notice that the client-side script is inserted with the <SCRIPT> tag, as if it were included on a regular HTML page. The server-side script isn’t really a script, just a call to the Time() function. You could have inserted as many statements as necessary, as long as they were included in a pair of <% and %> tags.

After this introduction to the basic structure of ASP files, we can turn our attention to the objects of the Active Server and see how they can help you develop interactive Web pages. In developing ASP applications, we are primarily interested in interacting with the server, rather than writing elaborate HTML code or even client side scripts.

The emphasis is in writing server-side code that reads data submitted by the client, processes them on the server (in most cases, with ActiveX components that reside on the server), and produces Web pages on the fly, which are transmitted back to the client. With any other server, this process requires CGI scripts and, in general, programming in C-like languages. With Active Server Pages and the builtin objects, the tasks that would normally require Perl or C++ programming can be taken care of with VBScript.

In the rest of the chapter, we are going to examine these objects and see how they simplify scripting on the server. At the end of the chapter, we’ll look at some of the basic components, especially the Database component, which lets your script access databases on the server.

Posted on November 6, 2015 in Active Server Pages

Share the Story

Back to Top