1 / 14

ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 3

ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 3. Client Side Scripting JavaScript. What Is It. A client side scripting language It can be inserted into HTML Placed between script tags

Download Presentation

ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECMM6018 Enterprise Networking For Electronic CommerceTutorial 3 Client Side Scripting JavaScript

  2. What Is It • A client side scripting language • It can be inserted into HTML • Placed between script tags • It can be referenced externally from a .js file or form part of the HTML file which uses it E.g. <script language="Javascript" src="validate.js"></script> • It can be used in both Netscape Navigator and Microsoft Internet Explorer

  3. More About JavaScript • Object Oriented type language e.g. <html> <head> </head> <body> <script type="text/javascript"> document.write(“Hello World”); </script> </body> </html>

  4. Variables • Memory locations used to store information • Must be not be reserved keywords e.g. break, new, this • They can be any valid identifier • A valid identifier being any series of characters which consist of letter, digits, underscores and dollar signs E.g. account, salary, cla_ss • They cannot begin with a number or contain space e.g. 8mec, java st • JavaScript is Case Sensitive e.g. VaRiAbLe ≠ Variable • Declaration var variablename = some variable

  5. Operators • Arithmetic Operators • Assignment Operators • Comparison Operators • Logical Operators

  6. Arithmetic Operators • () Evaluated first • *, / or % Evaluated second. If several are used they are evaluated left to right • + or - Evaluated last. If several they are several, they are evaluated left to right

  7. Comparison Operators • = = is equal to • != is not equal to • > is greater than • < is less than • >= is greater than or equal to • <= is less than or equal to

  8. Logical Operators • && and • || or • ! not

  9. Functions • A reusable piece of code which is invoked either by an event or when the function is called e.g. of an event, window.alert(“This is a JavaScript Tutorial”) Defining a function function myfunction(argument1,argument2,etc) { some statements } function myfunction() { some statements }

  10. More About Functions • The Return Statement • All functions must have the return statement E.g. function total(a,b) { temp = num1+num2; return temp; } • Function would be called liked this Sum = total(9,10)

  11. Conditional Statements • Conditional statements in JavaScript are used to perform different actions based on different conditions. • If, If-Else statement Syntax if (condition) { code to be executed if condition is true }

  12. Conditional Statements ctd. • Syntax If-Else • If(condition) { code to executed if condition is true } Else { other code is executed }

  13. Algorithm Development • A step-by-step problem-solving procedure • The actions to be executed • The order in which they are to be executed

  14. Useful Links • www.w3schools.com • www.JavaScript.com • www.webreference.com

More Related