Web Basics ISYS546. Basic Tools Web Server –Default directory, default home page –Virtual directory Web Page Editor –Front Page Web Languages –HTML, XML.

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

JavaScript and the DOM Les Carr COMP3001 Les Carr COMP3001.
The Web Warrior Guide to Web Design Technologies
Client-Side Web Application Development with Java ISYS 350.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
JavaScript Forms Form Validation Cookies CGI Programs.
Web Basics ISYS546. Basic Tools Web server –Default directory, default home page –Virtual directory Web page editor –Front Page Web page languages –HTML,
Javascript Document Object Model. How to use JavaScript  JavaScript can be embedded into your html pages in a couple of ways  in elements in both and.
20-Jun-15 JavaScript and HTML Simple Event Handling.
Client Side Scripting BICS546. Client-Side vs Server-Side Scripting Client-side scripting: –The browser requests a page. –The server sends the page to.
JavaScript Client Side scripting. Client-side Scripts Client-side scripts, which run on the user’s workstation can be used to: Validate user inputs entered.
1 More JavaScript, HTML Forms, CGI Scripts Tom Horton Alfred C. Weaver CS453 Electronic Commerce.
JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.
JavaScript - Document Object Model. Bhawna Mallick 2 Unit Plan What is DOM and its use? Hierarchy of DOM objects. Reflection of these objects in an HTML.
Introduction to JavaScript Dr. John P. Abraham University of Texas – Pan American.
Client-Side Web Application Development with JavaScript ISYS 350.
Client-Side Web Application Development with JavaScript
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaScript Fundamentals.
Internet Mark-up Languages CO32036 Part Lecture: Elementary JavaScript.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Using Client-Side Scripts to Enhance Web Applications 1.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Website Development with PHP and MySQL Saving Data.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Intro to JavaScript Scripting language –ECMAScript compliant –Client side vs. server side Syntactic rules –White space –Statement end: ; optional –Comments:
Client-Side Web Application Development with JavaScript ISYS 350.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Client-Side Web Application Development with JavaScript ISYS 350.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
Introduction to JavaScript Objects, Properties, Methods.
JavaScript, Fourth Edition Chapter 4 Manipulating the Browser Object Model.
Introduction To JavaScript. Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script.
Jaana Holvikivi 1 Introduction to Javascript Jaana Holvikivi Metropolia.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Web Page Introduction. What is a web page? A hypertext is a document contains clickable links. A web page is a text file containing Hyper Text MarkUp.
Making dynamic pages with javascript Lecture 1. Java script java versus javascript Javascript is a scripting language that will allow you to add real.
© 2007 D. J. ForemanJS-1 A Light Introduction for Non-programmers JavaScript for Beginners.
COS 125 DAY 20. Agenda Assignment 8 not corrected yet Assignment 9 posted  Due April 16 New course time line Discussion on Scripts 
OBJECTS What is an Object? Definition Properties Methods Events.
Web Page Introduction. What is a web page? A hypertext is a document contains clickable links. A web page is a text file containing Hyper Text MarkUp.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Chapter 4 Java Script – Part2. 2 Location object Properties Properties href – whole path will be displayed. ex: window.location.href ( see example 11)
JavaScript and HTML Simple Event Handling 11-May-18.
In this session, you will learn to:
Web Development & Design Foundations with HTML5 7th Edition
JavaScript for Beginners
14 A Brief Look at JavaScript and jQuery.
JavaScript and HTML Simple Event Handling 19-Sep-18.
Introduction to JavaScript
JavaScript and Ajax (JavaScript Events)
JavaScript for Beginners
Web Programming and Design
JavaScript and HTML Simple Event Handling 26-Aug-19.
JavaScript and HTML Simple Event Handling 4-Oct-19.
Presentation transcript:

Web Basics ISYS546

Basic Tools Web Server –Default directory, default home page –Virtual directory Web Page Editor –Front Page Web Languages –HTML, XML –Client-side script language: VBScript, JavaScript –Server-side language: VB.NET, ASP.NET

Dynamic Web Pages Demo: TimeNow – – The time is now –<% –dim iHour –iHour=hour(time()) –if iHour < 12 then –response.write "good morning" –else –response.write " good afternoon " –end if –%>

Client-Side vs Server-Side Scripting Client-side scripting: –The browser requests a page. –The server sends the page to the browser. –The browser sends the page to the script engine. –The script engine executes the script. Server-side scripting: –The browser requests a page. –The server sends the page to the engine. –The script engine executes the script. –The server sends the page to the browser. –The browser renders the page. Demo: ShowSum.htm, Web Form

HTML Introduction Heading section –,,,, etc. Body section –,, to,, –Formatting:,,, –Comment: –List –Image –Table:, : a new row in table, : a new cell in a table row. –Form:,,,

Webpage Editor FrontPage demo Demo: Use Response.write to write the html code generated by FrontPage.

META Tag The meta tag allows you to provide additional information about the page that is not visible in the browser: – Redirection: – “3” is number of seconds. Demo: Redirect.htm

TABLE Tag

FORM Tag Form attribute: –Action: Specify the URL of a program on a server or an address to which a form’s data will be submitted. –Method: Get: the form’s data is appended to the URL specified by the Action attribute as a QueryString. Post: A prefered method for database processing. Form’s data is sent separately from the URL. –Name: Form’s name –Target: Specified a window in which results returned from the server appear.

QueryString A QueryString is a set of name=value pairs appended to a target URL. It can be used to pass information from one webpage to another. To create a QueryString: –Add a question mark (?) immediately after a URL. –Followed by name=value pairs separated by ampersands (&). Example:

Creating a QueryString User typed URL As part of a URL specified in an anchor tag. Via a form sent to the server with the GET method. –Demo: TestReqFormQ.htm

Client-Side Script Tag HTML and Vbscript are not case-sensitive; Javascript is case-sensitive, each statement ends in a semicolon (;).

Script Example <!-- statements -->

Hello World document.write (" Hello world ");

Variable Declaraton JS:var intrate, term, amount; VB:dim intrate, term, amount Data Type: –Variant - a variable’s data type is determined when it is initialized to its first value. Variable scope: –Local: Variables declared in a function or procedure. –Global: Variables declared in the heading section, but not in a function or procedure.

Arrays JS: var arrayName = new Array(array size); var Pet = new Array(2); Pet[0]=“dog”; Pet[1]=“cat”; Pet[2]=“bird”; VB: dim arrayName(array size) Dim Pet(2) Pet(0)=“dog” Pet(1)=“cat” Pet(2)=“bird”

Comments JS: –Single-line comment: // –Multiple-line comments: /* … */ VB: single quotation mark ‘

Operators Arithmetic operators: –JS: +, -, *, /, Math.pow(x,y), etc. Math is an object with many methods such as round(x), random(), sqrt(x), ceil(x), floor(x), etc. –JS: Prefix operator: ++VarName, --VarName Postfix operator: varName++, varName-- –VB:+. -, *, /, ^ Comparison operators: –JS: = =, !=,, = –VB: =, <>,, = Logical operators: –JS: &&, ||, ! –VB: AND, OR, NOT

IF Then Statements JS:if (condition) { statements; } else { statements; } VB:if (condition) then statements else statements end if

Case Statements JS: Switch Case Statement switch(varable name) { case value1: statements; break; case value2: statements; break; … default: statements; break; } VB: Select Case statement

Loop Structures JS: 1.while (condition) { statements; } 2. do{ statements; } while (condition) 3.for (var I = 0; I<5;I=I+1){ statements; }

JavaScript Build-In Objects and Methods Math object String object: In JS, a string variable is an object and can be created by: –varName = “Smith” –varName = new String(“Smith”) String object methods: – bold, fontcolor, fontsize, toLowerCase, toUpperCase – anchor (create a bookmark), link (create a link) –Substring, split (split a string into an array)

Examples of Using String’s Methods var test = “Click Here”; var website = test.link(website); var test = “one, two, three”; var newArray = test.split(“,”); Note: split is useful in parsing a queryString.

JavaScript’s Conversion Functions toString() example: Price=5; Qty=10; Amount=Price*Qty; Document.write (Amount.toString()); Eval strVar = “5”; numVar = eval(strVar)

JavaScript Functions Defining functions – function functionName(arg1,..,argN){ Statements; return return value; –} Note: 1. The arguments are optional. 2. The return statement is optional. A function is not required to return a value.

VBScript Functions Defining functions: –Function functionName(arg1,..,argN) Statements functionName=returnValue –End Function –Note: Unlike VB, a function is not required to return a value.

Browser Object Model

Window Object The Window object represents a Web browser window. We use the properties and methods of a Window object to control browser window.

Window Object Properties: –window.status, window.defaultstatus –window.document, window.history, window.location. –Window.name Methods: –window.open (“url”, “name”, Options) Options: menubar=no, status=no, toolbar=no, etc. –window.close –window.alert(“string”) –window.prompt(“string”) –Window.confirm() –window.prompt(“string”, “default string”) –window.focus(), window.blur() :set/remove focus –Window.setTimeout(“statements”, milliseconds)

Document Object The document object represents the actual web page within the window. Properties: –background, bgColor, fgColor, title, url, lastModified, domain, referrer, cookie, linkColor, etc. Ex. document.bgColor=“silver”; Methods: –Document.write (“string”) –Document.open, close Demo (testDOm.htm, docProp.htm, testDoc.htm)

Navigator Object The navigator object provides information about the browser. Properties: –Navigator.appName:browser name –Navigator.appCodeName: browser code name –Navigator.appVersion –Navigator.platform: the operating system in use.

Location Object Allows you to change to a new web page from within a script code. Properties: –Host, hostname, pathname –Href: full URL address –Search: A URL’s queryString Methods: – location.reload() – location.replace(); replace current page and old page’s entry in the history. To open a page:location.href = “URL” Demo: TestLocation.htm

History Object Maintain a history list of all the documents that have been opened during current session. Methods: – history.back() – history.forward() – history.go(): ex. History.go(-2) Demo: testDocOpenClose.htm

Client-side Scripting with the Browser Object Model window.status = "Testing DOM" New Page 1 if (navigator.appName == "Netscape") { document.write("you are using Netscape!"); } else { document.write("You are using Explorer!"); } =window.prompt("Enter "); window.alert ("your enail is:" + ); site=window.prompt("enter url:"); window.open (site); // document.open(); document.write("today is: " + Date()); //JavaScript is case-sensitive: Date(), not date(). =window.prompt("Enter ") window.alert ("your enail is:" & ) site=window.prompt("enter url:") window.open (site) document.open() document.write("today is: " & Date())

Testing the History Object <!-- sub clearVB() document.write ("hello, this is a new page") window.alert("Press any key to continue") document.open() document.write (" This is another new page ") document.close window.alert("Press any key to go back") history.go(-2) end sub --> New Page 1 this is old info document.write (" this is another old info ")

Testing Location Object function openNew() site=window.prompt("enter url:") window.open (site) location.href="showformdata.htm" end function New Page 1

HTML Tags and Events Link : click, mouseOver, mouseOut Image : abort(loading is interrupted), error, load. Area : mouseOver, mouseOut Body : blur, error, focus, load, unload Frameset: blur, error, focus, load, unload Frame: blur, focus Form: submit, reset Textbox, Text area: blur, focus, change, select Button, Radio button, check box: click List: blur, focus, change

Event Handler Event handler name: on + event name –Ex. onClick Three ways of writing handler: –1. Within the tag –2. Event function: onCLick=“clickHandler()” –3. Event procedure as in VB. Sub button1_onCLick()

Form Object Form Input/Select object: –Textbox, radio button, check box, drop-down list box, text area, push button, submit button, reset button. Event-Handler: –onBlur (lose focus), onCHange, onClick, onFocus, onKeyDown, onKeyPress, onKeyUp, onLoad (when a document is loaded), onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onReset(when click the reset button), onResize(when window is resized), onSubmit. Refer an input object in a form: – document.formname.inputobjName.Value Demo: showFormData.htm

Forms Collection The forms collection is a collection of form objects within the document object. To retrieve a form’s`property: –document.form[index].property Base 0 index –Document. formname.property