Lecture 6 Footnotes& Answers

360 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
360
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • In general, you cannot use JavaScript alone to check a registered user for an eCommerce site. Reasons: User data is usually kept in a database which is installed on the Web server side rather than on the client side. So, you need to use server side programs such as ASP .Net, JSP, Servlets, Perl, PhP, CGI etc. to develop the validation codes.
  • JavaScript is better because JavaScript can be executed by any Web browser programs; JavaScript is better because it is executed on the client side to save the turnaround time and share the workload of the Web server. VBScript: codes can only be executed by Windows operating system; ASP .Net (Visual Basic): codes are executed by the IIS Web server; Java Server Page: codes are executed by the Tomcat Web server;
  • Script language (e.g., JavaScript) usually is simpler than full functional computer programming language (e.g., Java). Easier for you to learn! Script language requires an interpreter program to execute the codes and the execution speed is slower; Full computer programming language like C++ can be directly executed by the Operating System, and it is executer much faster;
  • 12
  • Lecture 6 Footnotes& Answers

    1. 1. IS4 030 - Website Design for e-Commerce By SMIEEE, SMACM, MACS E-mail: [email_address] Room: P7919 Consultation Hours: 3:30 - 5:30pm Monday Lecture Six –JavaScript I
    2. 2. Validating Forms <ul><li>Data entered by users should always be validated! </li></ul><ul><li>Validation should take place in the browser for speed , but also on the server as well e.g., if a user is a registered Web site client </li></ul><ul><li>Question </li></ul><ul><li>Could we use JavaScript to check if a user is a registered user for a Web site e.g., a valid student a/c at CityU? </li></ul>
    3. 3. Validating Forms <ul><li>Basic validation program codes (e.g., checking a field is blank or not) can be written in JavaScript, VBScript or Java Server Page, ASP.NET , but JavaScript is preferred. Why?? </li></ul><ul><li>Form should have a name attribute so you can access the fields by using computer programs (e.g., JavaScript, ASP .Net, etc.) </li></ul>
    4. 4. What is a Function? <ul><li>A function is an operation that can return a value. </li></ul><ul><li>e.g., Sin(90) = 1, Sin is a function and 1 is the value return by the function. </li></ul><ul><li>Some Script languages such as JavaScript use pre-defined functions to carry out Web page display/validation operations. </li></ul><ul><li>The difference between scripting language (e.g., Javascript) and full computer language (e.g., Java)? </li></ul>
    5. 5. Object-Base Script Language <ul><li>Properties are the values associated with an object </li></ul><ul><li>e.g., “txt” is an object and “length” is its property </li></ul><ul><li><html> </li></ul><ul><li><body> </li></ul><ul><li><script type=&quot;text/javascript&quot;> </li></ul><ul><li>var txt=&quot;Hello World!&quot; </li></ul><ul><li>document.write( txt.length ) </li></ul><ul><li></script> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul><ul><li>What will be the output from the Browser? </li></ul>

    ×