1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.

Slides:



Advertisements
Similar presentations
Working with Intrinsic Controls and ActiveX Controls
Advertisements

ISOM3230 Business Applications Programming
PL/SQL.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
The Web Warrior Guide to Web Design Technologies
Chapter 10.
Val Function A Function performs an action and returns a value The expression to operate upon, known as the argument, (or multiple arguments), must be.
VBA Modules, Functions, Variables, and Constants
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Arrays Array of Controls: several controls, of the same type (Class: a prototype for an object indicating the properties and methods), that have the same.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
CSC110 Fall Chapter 5: Decision Visual Basic.NET.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Chapter 2 Data Types, Declarations, and Displays
ASP.NET Programming with C# and SQL Server First Edition
JavaScript, Third Edition
Repeating Program Instructions Chapter Microsoft Visual Basic.NET: Reloaded 1.
Arrays Array of Controls: several controls, of the same type (Class: a prototype for an object indicating the properties and methods), that have the same.
5.05 Apply Looping Structures
Chapter 4: The Selection Structure
Saeed Ghanbartehrani Summer 2015 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering.
Mr C Johnston ICT Teacher BTEC IT Unit 06 - Lesson 05 Learning To Program.
2440: 211 Interactive Web Programming Expressions & Operators.
Language Elements 1. Data Types 2 Floating Point (real) Single Precision Double Precision Decimal Fixed Point (integer) Byte Short Integer Long Numerical.
Chapter 3: Data Types and Operators JavaScript - Introductory.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Using Client-Side Scripts to Enhance Web Applications 1.
Chapter Six: Working With Arrays in Visual Basic.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
VBScript Language. What is VBScript Based on the Visual Basic family of languages Supports object oriented features Interpreted Loosely Typed Implicitly.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
‘Tirgul’ # 3 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #3.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
I Power Higher Computing Software Development High Level Language Constructs.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
JavaScript, Fourth Edition
Copyright © 2001 by Wiley. All rights reserved. Chapter 6: Using Arrays Control Arrays List Arrays Finding Items in Arrays Multiple Forms 2-Dimensional.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
CIVIL AND GEOMATIC ENGINEERING FT Okyere. CIV 257- COMPUTER PROGRAMMING Lecture 3.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
Controlling Program Flow with Decision Structures.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2002 Prentice Hall. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1Introduction 5.2 Essentials of Counter-Controlled Repetition.
ME 142 Engineering Computation I Interacting with Spreadsheets.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
By “FlyingBono” 2009_02By FlyingBono.  ASP code is embedded in HTML using tags.  A ASP scripting block always starts with.  Server scripts are executed.
A variable is a name for a value stored in memory.
VBA - Excel VBA is Visual Basic for Applications
Visual Basic 6 (VB6) Data Types, And Operators
Chapter 4: The Selection Structure
2. Understanding VB Variables
Chapter 6 Variables What is VBScript?
Chapter 8 JavaScript: Control Statements, Part 2
WEB PROGRAMMING JavaScript.
T. Jumana Abu Shmais – AOU - Riyadh
Decisions and Conditions
CIS 16 Application Development Programming with Visual Basic
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 1/15/2019.
Quick Test Professional Training Part 1
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 7/9/2019.
Introduction to Computer Programming IT-104
Presentation transcript:

1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer and Netscape Perl - Used at the server side Server v.s. Client programming VBScript is similar to VB programming, but uses a subset of the language.

2 VBScripting To include a control use input tags. – To have VBScript recognized by the browser - use the following: –

3 VBScripting contd. To build the command button for the Input tag: – –<!-- –Sub cmdButton_OnClick Msgbox ”Please enter a number from 1 to 10." –End Sub

4 Data - Variables & Constants Constant is data that will not change - fixed in value Variable is data that can change during the course of the running of a program Identifier is a name assigned to a variable or constant - memory is reserved for the variable / constant Declaration statements define the variable / constant for the program

5 Declaration Statements Const Identifier [As Datatype] = Value Const is a reserved word to define a constant in the declaration section Dim Identifier [As Datatype] A defaulted datatype becomes type variant String values are called string literals Intrinsic constants are VB built-in constants

6 Data Types Boolean - True or False value (0 or 1) Byte - A single ASCII character Single & Currency - Floating Point Date - An eight character date Double - Double precision floating point Long & Integer - Whole number String - Alphanumeric characters Variant - Stores any type

7 Local Declarations The Dim statement can be placed anywhere within the local procedure It is recommended to be placed at the top of the procedure It must be placed before the variable is used Variables and constants can be declared locally

8 Arithmetic Operators The order of precedence is as follows: – Exponentiation - [^] – Multiplication and Division - [*, /] – Addition and Subtraction - [+, -] Use parenthesis to change evaluation order of a mathematical expression All evaluations occur from left to right Parenthesis are performed first then in the order of precedence

9 Arrays A series of items (Data Types) that are related to one another They use the same name with an index to each part (element) of the array They are similar to a control array except they are for data storage The name tables or subscripted variables is sometimes used with them The index is the subscript of the array

10 Dimensioning Arrays The Dim statement is used similar to all other declarations Dim Arrayname ([lower To] Upper) [As Datatype] The lower subscript is not necessary - if left out the lower subscript will be zero The datatype may be left out and defaults to variant All data elements are initialized to zero for numerics and null string for strings

11 Dynamic Arrays Arrays can be dimensioned dynamically An array declared as - Dim Name() As Integer Will allow redimensioning during program execution The Redim statement is used to rediminsion an array All other arrays are static arrays

12 Array Subscripts The subscript used to reference into the array can be a constant A literal number A variable A numeric expression The subscript MUST reference a valid element of the array

13 Message Boxes Message Boxes are used to notify the user of an error or display information The message box can contain a message, icon, title bar caption or command button MsgBox “message” [,buttons/icon][, “title bar”] Displays the message centered in box Displays title bar caption in the title bar

14 Message Box Buttons vbOKOnly Shows only the OK button vbOkCancel Shows the OK and Cancel buttons vbAbortRetryIgnore Shows the Abort, Retry and Ignore buttons vbYesNoCancel Shows the Yes, No and Cancel buttons vbYesNo Shows the Yes and No buttons vbRertyCancel Shows the Retry and Cancel buttons

15 Message Box Parameters vbCritical Uses a Critical X as an indicator vbQuestion Uses a Question mark as an indicator vbExclamation Uses a Exclamation point as an indicator vbInformation Uses an I as an indicator

16 Message Box Return Codes vbOk -1 - Indicates an OK status vbCancel Indicates a return of cancel vbAbort Indicates a return of abort vbRetry Indicates a return of retry vbIgnore Indicates a return of Ignore vbYes Indicates a return of yes vbNo Indicates a return of No

17 Procedures / Functions A sub procedure is code that performs a given operation, but does not return anything. A function is code that performs a given operation and then returns a value to the caller. This value can be the result of some operation or just an error code. The returned value is accomplished by using the name of the function and assigning a value. To exit a sub procedure prematurely use Exit Sub.

18 Functions Functions perform an action and return a value associated with that action The VAL function will convert data into a numeric format The Val function converts until the first non-numeric character is read

19 System Procedures There are two types of system classes. –Events - a subroutine executed automatically by the system when a certain event takes place. OnBlur - executed when an object is deselected OnChange - executed when a user changes the object OnClick - executed when an object is clicked OnFocus - executed when an object is active (user selects) –Methods - controlled events. Methods normally are used to cause something to occur. Calling a method is done by using the object name and the method name. Objectname.Methodname

20 Conditional Statements If ( condition) Then – statements ElseIf (condition) Then – statements Else – statements End If All data types must be of the same type

21 Relational Operators The relational operators are used to compare two values - the result of the comparison is either True or False > - Greater than < - Less than = - Equal to <> - not equal to >= - Greater than or equal to <= - Less than or equal to

22 Conditional Statements contd. ASCII comparisons, handled left to right All string literals must be enclosed in double quotes Be careful using text boxes - their data type is variant To check uppercase characters - Ucase() To check lowercase characters - Lcase() Use logical operators to test multiple conditions - Or, And, Not, Xor, Equ, Imp

23 Conditional statements contd. Nested If Statements can be used, just remember to include the End If inside the nested If The nesting can be accomplished in the Then portion of the condition, or in the Else portion The ElseIf statement or an If within an If are both valid statements It is highly recommended to flowchart conditional statements

24 Case Statements Multiple If tests (nested or otherwise) can be replaced with the Case Statement It is easier to read and easier to construct

25 Case Statement contd. Select Case expression – Case Is relational expression Statement – Case Constant To Constant Statement – [Case Else] Statement End Select

26 Do Loops Do Loops repeat instructions until a condition is met Do While condition –statements to be repeated Loop Do –statements to be repeated Loop Until condition

27 For / Next Loops Used to allow repetitive operations in a sequence of code. For LoopIndex = Startvalue To EndValue [Step Increment] – statements to be repeated Next LoopIndex The Loop Index must be declared before entering the loop and the end value must be attainable.

28 For / Next Loops contd. Once the end value has been reached the execution will drop out of the loop. Negative numbers are allowed for the step value Altering the values of the control variables will not affect the operation of the loop