Browser Object Model& Debugging CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams.

Slides:



Advertisements
Similar presentations
Chapter 3 Syntax, Errors, and Debugging
Advertisements

COM311H Zheng, School of C&M, UUJ1 Dynamic Web Authoring JavaScript Basics (Array and Function)
Programming with JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and.
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 8: JavaScript I.
1 Modularity In “C”. 2 General Syntax data_type function_Name (parameter list) { … return expression; // return output } Body of the function is a compound.
Writing Methods. Create the method Methods, like functions, do something They contain the code that performs the job Methods have two parts.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Getting Started With Java Downloading and installing software Running your first program Dr. DwyerFall 2012.
Introduction to High-Level Language Programming
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Chapter 4 Chapter 4 Creating a Simple Page Disclaimer: All words, pictures are adopted from “Learning Web Design (3rdeds.)” by Jennifer NiederstRobbins,
Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
CITS1231 Web Technologies JavaScript and Document Object Model.
Lesson 6. GCSE Computing – programming languages Candidates should be able to:  describe common tools and facilities available in an integrated development.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
Objective Static vs. Dynamic Web pages. Variables. Assignments. JavaScript Hierarchy of Objects JavaScript Functions (prompt(“”,””) Document.write(“”)
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
1 JavaScript in Context. Server-Side Programming.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Using Client-Side Scripts to Enhance Web Applications 1.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
XP Tutorial 6 New Perspectives on JavaScript, Comprehensive1 Working with Windows and Frames Enhancing a Web Site with Interactive Windows.
JavaScript Adding active content to websites. Goals Understand structure of JavaScript Understand rules of coding Add active content to WebPages Add functions.
Events and Animations CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also from.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
C++ Programming Lecture 7 Control Structure I (Selection) – Part II The Hashemite University Computer Engineering Department.
C++ Programming Lecture 13 Functions – Part V The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
The Hashemite University Computer Engineering Department
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
5.01 Understand Different Types of Programming Errors
Document Object Model CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also from.
CISW CRC - Fishman 2014 / 2015 PRESENTATION 4b: CISW 400 (Online) – Client-side Scripting for the Internet Cosumnes River College Fishman – 2015.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Beginning JavaScript 4 th Edition. Chapter 1 Introduction to JavaScript and the Web.
Working with the Window Object JavaScript considers the browser window an object, which it calls the window object.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
C++ Programming Lecture 13 Functions – Part V By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Last week: We talked about: History of C Compiler for C programming
5.01 Understand Different Types of Programming Errors
Engineering Problem Solving With C An Object Based Approach
Tutorial 10 Programming with JavaScript
Eclipse Navigation & Usage.
Testing and Debugging.
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
C-language Lecture By B.S.S.Tejesh, S.Neeraja Asst.Prof.
Web Systems Development (CSC-215)
5.01 Understand Different Types of Programming Errors
Unit 1: Introduction Lesson 1: PArts of a java program
Tonga Institute of Higher Education
CS105 Introduction to Computer Concepts
Programming Fundamentals Lecture #3 Overview of Computer Programming
CS105 Introduction to Computer Concepts JavaScript
Presentation transcript:

Browser Object Model& Debugging CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also from W3schools. Edited by Guoliang Liu, Only for Course CSc2320 at GSU CS Department

In this chapter Browser Object Model (BOM) Debugging

Browser Object Model (BOM) BOM ◦ No official standards (DOM has) ◦ Includes:  Global variables  Global functions  DOM  window.document.getElementById("header");  Screen  Location  History  Navigator  Pop-ups  Timing  Cookies

Browser Object Model (BOM) Window ◦ Two properties:  window.innerHeight: the inner height of the browser window  window.innerWidth: the inner width of the browser window ◦ Functions:  window.open() - open a new window  window.close() - close the current window  window.moveTo() -move the current window  window.resizeTo() -resize the current window

Browser Object Model (BOM) Screen ◦ Get it by using window.screen ◦ Properties:  screen.availWidth - available screen width  screen.availHeight - available screen height ◦ E.g.,

Browser Object Model (BOM) Location ◦ Get it by using window.location ◦ Properties:  location.hostname  location.pathname  location.port (80)  location.protocol (http or https)  location.href: return the url ◦ Function:  window.location.assign(): change the locationchange the location

Browser Object Model (BOM) History ◦ Get it by using window.history ◦ Functions:  history.back()  history.forward() ◦ E.g.,  function goBack() { window.history.back(); }

Browser Object Model (BOM) Navigator: ◦ Get it by using window.navigator ◦ Methods:  Depends on browsers and not accurate.  E.g.,  Check the navigator Check the navigator

Browser Object Model (BOM) Pop-ups ◦ Alert box  Window. alert(); ◦ Confirm box  Window.confirm();  E.g., confirm boxconfirm box ◦ Prompt box  Window.prompt ();  E.g., prompt boxprompt box

Browser Object Model (BOM) Timing ◦ The timing functions in animation in last lecture.

Browser Object Model (BOM) Cookies ◦ Get it by using document.cookie ◦ What is cookie and where is it?  Variables store user information  In visitor’s computer

Debugging Common errors ◦ Syntax errors  Compiler never goes through ◦ Runtime errors  E.g., overflow problems ◦ Logic errors  Does not behave as expected

Debugging How to debug? ◦ Tools in browser  Simple tools with debugging in all kinds of browser  IE, Firefox, Chrome and so on.  Plug-ins in Firefox  Firebug  Test in the browser

Debugging How to prevent syntax errors and easily locate the errors. ◦ Make it readable.  Keep your code incident for each block ◦ Use editors with type verification  Eclipse

Debugging Be aware of runtime errors. ◦ Define appropriate data types for variables.  Int, float, double all have their range according to different kinds of languages. ◦ Keep your eye on the static array size, avoid the overflow. Keep your logic strict when you code instead of when you debug. ◦ In your mind, never consider your program job as two parts: edit and debug. ◦ Be aware of polymorphism of functions, scope of variables. ◦ Add brief comments when you program big!

Debugging Output debugging for programmers ◦ Output something in some point of your program. ◦ Spirit: similar with adding breaking point. ◦ Advantages: Divide your code and nail each bug in each part.