INT213 – WEEK 1 ASP tags and comments Variables, Constants, and "Literals" Simple Output.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
1 Today: Introduction to ASP- Part 1 Explain the client/server architecture Explain Web-based client/server applications Understand the essentials of Active.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
1 Active Server Pages Active Server Pages (ASPs) are Web pages ASP = server-side scripts + HTML The appearance of an Active Server Page depends on who.
Data Types and Operations Programming Fundamentals (Writing Code)Programming Fundamentals (Writing Code)
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
Using Data Active Server Pages Objectives In this chapter, you will: Learn about variables and constants Explore application and session variables Learn.
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
CIS 451: ASP.NET Debugging and Server-Side Includes Dr. Ralph D. Westfall February, 2009.
Lecture Note 3: ASP Syntax.  ASP Syntax  ASP Syntax ASP Code is Browser-Independent. You cannot view the ASP source code by selecting "View source"
National Diploma Unit 4 Introduction to Software Development Data types, variables and constants.
CS1 Lesson 2 Introduction to C++ CS1 Lesson 2 -- John Cole1.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
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.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Website Development with PHP and MySQL Saving Data.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
INT213 Week 1.  A Named storage area (in RAM) that can hold a value (like a mailbox holding a letter)  Contents of a variable can be assigned, changed.
EIW - ASP Introduction1 Active Server Pages VBScript.
Introduction to PHP Advanced Database System Lab no.1.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Introduction to Programming
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part One.
INT213-Week-2 Working with Variables. What is variable
Web111a_chapt08.ppt HTML: Section 8 JavaScript CGI Programs (Server Side programs) Common Gateway Interface Run on server Communicate with user across.
1 Server versus Client-Side Programming Server-SideClient-Side.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Programming with Microsoft Visual Basic th Edition
PROGRAM ESSENTIALS. TOKENS  SMALLEST UNITS OF A PROGRAM LANGUAGE  Special Symbols  Mathematical Operators  Punctuation  Word Symbols  Key Words.
INT213 INT213 – Managing Windows with VBScript VBScript Variables ASP State Management.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
CIS 338: VB Variables Dr. Ralph D. Westfall April, 2011.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
By “FlyingBono” 2009_02By FlyingBono.  ASP code is embedded in HTML using tags.  A ASP scripting block always starts with.  Server scripts are executed.
Chapter # 2 Part 2 Programs And data
>> Introduction to JavaScript
A variable is a name for a value stored in memory.
VBScript Session 1 Dani Vainstein.
VBScript Session 1 IT Professional Academy.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Active Server Pages Computer Science 40S.
Intro to PHP & Variables
Chapter 19 JavaScript.
Web Systems Development (CSC-215)
Chapter 6 Variables What is VBScript?
Chapter 8 JavaScript: Control Statements, Part 2
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
C++ Data Types Data Type
Web DB Programming: PHP
Chapter # 2 Part 2 Programs And data
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
VB Variables and Data
Chapter 2: Introduction to C++.
Tutorial 10: Programming with javascript
PHP Variables.
VBScript Session 1.
PHP an introduction.
Presentation transcript:

INT213 – WEEK 1 ASP tags and comments Variables, Constants, and "Literals" Simple Output

ASP files and tags  Internet Information Services Microsoft web server Special processing for any URL ending in.ASP ASP files mix objects, VBscript and HTML are ASP tags  contain VBscript programming and ASP object commands

Variables  What is a Variable? A named storage location is assigned a value The value can change during the run of the script

Variables — Rules  Naming Rules begin with a letter, then letters or numbers no punctuation except _ underscore cannot be a VBScript command word  Recommendations for naming Variables declare all variables at the top of your file do not use numbers: what is date1 vs. date2? use descriptive terms: counter, name, price capitalize multiple words (camelCase): errorCounter, familyName, unitPriceDiscount

Literals  Literals are hard-coded values that do not change.  "ABC DEF" is a text or character literal Always enclosed in double quotes  123 is a numeric literal Never enclosed in double quotes  Usually used once in a script

Constants  are variables that do not change  contain literals used more than once  ' define constants Const PI = ' pi Const BR = " " ' HTML break  Naming rules are same as for Variables  Use all capitals for good style and _ to separate words: SCHOOL_NAME = "School of ICT"

Comments  ' from single quote to end of line ' area of a circle circleArea = PI * radius * radius  How many comments are enough? If your script contained ONLY comments and non-programmer understands it and a programmer could write the code then you have enough comments

Variables NOT Declaring variables - By default, you do not have to declare variables - Logic Errors occur when variables are mystiped e.g. <% count = 1' variable we meant Response.write counter' variable we typed %> - Nothing will be seen on the browser - counter contains the default empty value

Variables Declaring variable names Tell VBScript to spell check variable names. - forces declaration of all variable names - to dimension (declare) a variable name

Variables Declaring and using variable names <% Option Explicit  must be 1 st line of VBscript code Dim givenName, familyName givenName = "Scott" familyName = "Mitchell" %> Author familyNane is not a declared variable. ASP server will send error message: Microsoft VBScript runtime (0x800A01F4) Variable is undefined: 'familyNane' /Week1_Variable_demo.asp, line nn

Actual Data Types  see Day 3 of textbook re Data Types  Integer (numbers), String (text), Boolean (true/false), Currency, Date  Understand the difference between data types: Integer 12 is not the same as String "12" sum = ' sum is 3468 department = "12" product = "3456" sku = department + product ' sku is "123456"

Variables  Use at the top of.asp files to prevent VBscript variable naming errors.  variables have default value of empty meaning default values of "" (zero length string) when system expects text 0 (numeric zero) in most—but not all—numeric contexts.  It is best to assign a zero value to variables used as numbers at the top of the script.

Variables – whose are they? ‘SCOPE’ of a Variable  How far does it go?  How long does it last?  Three levels: 1.Page (.asp file) 2.Session 3.Application

Variables – whose are they? Page is everything in an.asp file lasts while the.asp file is processed global  variables declared at top of page  accessed by all VBScript within the page local  variables declared and accessed only within a function or subroutine

Variables – whose are they? Session is a single client using a site's pages within a length of time session variable cannot be declared is an ASP object accessed by VBScript using it: Session("varName") = … accessed by all VBScript in ALL pages in the Application (in the same folder) lasts until client session 'times out' maintained separately for each client by ASP: unique value for each client

Variables – whose are they?

Variables with values