Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lecture 6 Footnotes& Answers


Published on

  • Be the first to comment

  • Be the first to like this

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>