Like coffee if coffee could read a script (that would be coffeescript)

Slides:



Advertisements
Similar presentations
Chapter 08: Adding Adding Interactivity Interactivity With With Behaviors Behaviors By Bill Bennett Associate Professor MSJC CIS MVC.
Advertisements

11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
The Web Warrior Guide to Web Design Technologies
11 ASP.NET Controls II Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Inline, Internal, and External FIle
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Introduction to scripting
Fundamentals, DOM, Events, AJAX, UI Doncho Minkov Telerik Corporation
Definition from Wikipedia.  The Prototype JavaScript Framework  implemented as a single file of JavaScript code  named prototype.js (
 jQuery Mobile An Introduction. What is jQuery Mobile  A framework built on top of jQuery, used for creating mobile web applications  Designed to make.
JQUERY – UI & THEMES "WRITE LESS, DO MORE" Built in interface elements.
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
4.1 JavaScript Introduction
JavaScript & jQuery the missing manual Chapter 11
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Server-side Scripting Powering the webs favourite services.
.Net is a collection of libraries, templates and services designed to make programming applications of all kinds, easier, more flexible (multi platform),
February 16, Aaron Cuffman Andy Nagle Adam Schultz Web Site.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
A really fairly simple guide to: mobile browser-based application development (part 4, JQuery & DOM) Chris Greenhalgh G54UBI / Chris Greenhalgh.
Chapter 2 Developing a Web Page. A web page is composed of two distinct sections: –The head content –The body Creating Head Content and Setting Page Properties.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Suzanne J. Sultan Javascript Lecture 2. Suzanne J. Sultan function What is a function> Types of functions:  Function with no parameters  Function with.
Introduction to HTML. What is a HTML File?  HTML stands for Hyper Text Markup Language  An HTML file is a text file containing small markup tags  The.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Pasewark & Pasewark 1 Access Lesson 5 Creating and Modifying Reports Microsoft Office 2007: Introductory.
© 2012 The McGraw-Hill Companies, Inc. All rights reserved. word 2010 Chapter 3 Formatting Documents.
XP Tutorial 6 New Perspectives on JavaScript, Comprehensive1 Working with Windows and Frames Enhancing a Web Site with Interactive Windows.
JavaScript - A Web Script Language Fred Durao
Button and Textbox. Input  Input objects are used to obtain input from the user viewing the webpage. They allow the user to interact with the Web. 
Things like Textboxes, Lables, ‘n’at. ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Web Foundations WEDNESDAY, NOVEMBER 20, 2013 LECTURE 32: DREAMWEAVER SLIDE SHOW AND GOOGLE MAP.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Pasewark & Pasewark 1 Access Lesson 5 Creating and Modifying Reports Microsoft Office 2007: Introductory.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
JavaScript Introduction. Slide 2 Lecture Overview JavaScript background The purpose of JavaScript A first JavaScript example Introduction to getElementById.
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Intro to jQuery. What is jQuery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event.
Web Programming Java Script & jQuery Web Programming.
Dawn Pedersen. What is JavaScript? JavaScript is the basis for both jQuery and Spry applications JavaScript is referred to as a client-side scripting.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
Understanding JavaScript and Coding Essentials Lesson 8.
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
05 | Integrating JavaScript and MVC 4 Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
G046 – Lecture 2A Recognising Web-Technologies Mr C Johnston ICT Teacher
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
© 2016, Mike Murach & Associates, Inc.
User Interface Design and Usability jQuery, jQuery UI & jQuery Plugins
Web Development in Microsoft Visual Studio 2013
JavaScript Introduction
DHTML Javascript Internet Technology.
DHTML Javascript Internet Technology.
Introduction to JavaScript
Presentation transcript:

Like coffee if coffee could read a script (that would be coffeescript)

Javascript Client side code All the code we’ve seen so far runs on the server Javascript is one way to run code on the client side You can avoid needing to do postbacks Javascript runs on all major browsers You can even write a Windows 8 app with it

Javacript Tons of libraries exist with new ones created/updated all the time

How to add it to a page Add this script tag to the header section of your page: If you plan on using this throughout your website, this would be something to put in a master page

How to use it Add a script tag for javascripts You can add it to the page or reference a separate.js file containing other javascripts alert("Hello world!");

Accessing elements Here’s our ASPX page:

Accessing Elements It Looks like this:

Accessing Elements Suppose we want to show an alert when the user clicks the button function showMessage() { var textbox = document.getElementById( "TextBox1") alert(textbox.value); }

Why didn’t that work? Value is null???

Name Mangling ASP.NET mangles control names. We have to use the ClientID The actual name of this textbox is: “ ctl00$ContentPlaceHolder1$Button1 “

How to get the correct ID Two ways: Static Id This turns off the name mangling You now have to manage the ID’s yourself Very easy to end up with name conflicts Use the Client Id Easy to use, but has a funny syntax

Static Id We need to set the ClientIDMode of the control

Static ID When the control renders, it will render without mangling the name. The ID is Static – it will not change

Static Id The ID is static, but the name is still mangled Our javascript will now work as is.

Accessing the ClientID To access the client ID, we need to change our javascript function showMessage() { var textbox = document.getElementById( " ") alert(textbox.value); }

Accessing the ClientID Our javascript will now render like this: function showMessage() { var textbox = document.getElementById( "ContentPlaceHolder1_TextBox1") alert(textbox.value); }

Accessing the ClientID And it works:

jQuery We’re going to focus on jQuery Easy to use Widely accepted Decent documentation

Accessing Elements jQuery uses a funny syntax for selecting elements $(“#IdOfControl”) function showMessageJquery() { var textbox = $("#" + " "); alert(textbox.val()); }

Accessing Elements Value of a textbox is not.value in jquery Most properties like this are accessed through methods.val() More concise syntax to access values Simple to use Return value is a jQuery object You now have access to other jquery methods

Show/Hide Adjusts the visibility of an element You can change the appearance of the document without needing a postback Adjusts the display style

Show/Hide

Show/Hide function showContent() { var content = $("#divShowHideContent"); content.show(); } function hideContent() { var content = $("#divShowHideContent"); content.hide(); }

Show/Hide

Toggle() Same method to show/hide content All 3 of these methods can take arguments to adjust the animation function toggleContent() { var content = $("#divShowHideContent"); content.toggle("Blind"); }

Toggle()

Other Effects There are tons of these Previews online:

DatePicker() Dates are annoying to type by hand. jQueryUI has a pre-built date picker to make this easier Associate a textbox with a datepicker

DatePicker() This one is found in jQueryUI In this case, we’re using a custom theme

DatePicker() $("#" + " ").datepicker();

DatePicker()

Modal Popups This is also found in jQueryUI Shows content in a window This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.

Modal Popups $("#dialog").dialog();