a primer on scripting objects

client-side scripting ~ runs in a browser: interpreted when browser loads page. to create ~ must specify type/language attribute in opening script tag. the document object methods document.write ( ) and document.writeln ( ) return output to the web page. document.writeln inserts a carriage return at the end of each line. to call external client-side script files ~ use *.js format/file extension to denote the file with the script tag’s source (src) attribute. when creating an external script file, just begin writing your script ~ no special tags required.

<script> src=’filenamehere.js’ type = ‘text/JavaScript’… </script>

server-side scripting (windows/MS) ~ runs on a web server: interepreted by the web server’s script engine. to create ~ can use (i) script tag pair with script’s runat attribute set to server, or (ii) inline tags.

(i) <script> type = ‘text/JavaScript’ runat=’server’… </script>
(ii) <% … %>

the asp (active server page) model comprises 6 objects: response, request, application, session, server, objectContext. to return output to the web page, use the response object’s write method: response.write( ). to reference an external server-script, call the *.inc file. all server-side code gets stripped from the html code before browser/client receives it ~ cannot be viewed via view source code.

No comments yet

Leave a reply