Intro to JavaScript CS 1150 Spring 2017.

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Lesson 12- Unit L Programming Web Pages with JavaScript.
The Web Warrior Guide to Web Design Technologies
Inline, Internal, and External FIle
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
4.1 JavaScript Introduction
HTML DOM.  The HTML DOM defines a standard way for accessing and manipulating HTML documents.  The DOM presents an HTML document as a tree- structure.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
JavaScript Introduction
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.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
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.
Manipulating the DOM CST 200 – JavaScript 3 –
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
JavaScript Introduction 1. What is Java Script ? JavaScript is a client-side scripting language. A scripting language is a lightweight programming language.
Animation & Effects Using JQuery. What is jQuery? jQuery is a lightweight, JavaScript library. The purpose of jQuery is to make it much easier to use.
JavaScript - A Web Script Language Fred Durao
Where does PHP code get executed?. Where does JavaScript get executed?
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
HTML JAVASCRIPT. CONTENTS Javascript Example NOSCRIPT Tag Advantages Summary Exercise.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
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.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
USING JAVASCRIPT TO SHOW AN ALERT Web Design Sec 6-2 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
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.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Understanding JavaScript and Coding Essentials Lesson 8.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
HTML DOM Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Chapter 4 Murach's JavaScript and jQuery, C4© 2012, Mike Murach & Associates, Inc.Slide 1.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
JavaScript, Third Edition 1 SELECTION LIST Demo. JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was.
Tarik Booker CS 120 California State University, Los Angeles.
Introduction to.
CGS 3066: Web Programming and Design Spring 2017
Web Basics: HTML/CSS/JavaScript What are they?
Event-Driven Programming
Getting Started with CSS
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Web Systems & Technologies
Using JavaScript to Show an Alert
CS 371 Web Application Programming
Concepts of HTML, CSS and Javascript
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
DHTML.
DHTML Javascript Internet Technology.
DHTML Javascript Internet Technology.
JavaScript MCS/BCS.
Javascript.
Javascript and JQuery SRM DSC.
Chapter 7 Event-Driven Pages
HTML and CSS Basics.
CNIT 133 Interactive Web Pags – JavaScript and AJAX
Introduction to Web programming
Presentation transcript:

Intro to JavaScript CS 1150 Spring 2017

In This Lecture What is JavaScript? What can JavaScript do? JavaScript output, syntax, statements, comments, and more

What is JavaScript? JavaScript is the programming language of HTML and the web JavaScript is one of 3 languages all web developers should learn, in addition to HTML and CSS

JavaScript and HTML Content JavaScript can change HTML content One of many JavaScript HTML methods is getElementById() This method can find an HTML element by its id attribute and change the content of that element Example: https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_inner_html

JavaScript and HTML Attributes JavaScript can change HTML attributes This example changes an HTML image by changing the src attribute of an <img> tag: https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_lightbulb

JavaScript and HTML Styles JavaScript can change the CSS dynamically This example shows how to change the CSS style with getElementById(): https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_style

JavaScript Hiding/Showing Elements JavaScript can hide or show HTML elements by changing the display style This example demonstrates hiding an element: https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_hide This example demonstrates showing an element: https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_show

The <script> Tag In HTML, Javascript code must be inserted between <script> and </script> tags

JavaScript Functions and Events A JavaScript function is a block of JavaScript code that can be executed when called for For example, a function can be called when an event occurs, like when the user clicks a button https://www.w3schools.com/js/tryit.asp?filename=tryjs_whereto_body

External JavaScript JavaScript code can also be placed into an external file, rather than being embedded in the HTML file Placing scripts in external files has advantages: It separates HTML and JavaScript code It makes HTML and JavaScript easier to read and maintain Cached JavaScript files can speed up page loads In this class, we will only use internal JavaScript

JavaScript Display Possibilities JavaScript can display data in different ways: Writing into an HTML element using innerHTML Writing into the HTML output using document.write() Writing into an alert box using window.alert() Writing into the browser console using console.log()

innerHTML Example https://www.w3schools.com/js/tryit.asp?filename=tryjs_output_dom

document.write() Example https://www.w3schools.com/js/tryit.asp?filename=tryjs_output_write Note: using document.write() after an HTML element is fully loaded will delete all existing HTML: https://www.w3schools.com/js/tryit.asp?filename=tryjs_output_write_over

window.alert() Example https://www.w3schools.com/js/tryit.asp?filename=tryjs_output_alert

console.log() Example https://www.w3schools.com/js/tryit.asp?filename=tryjs_output_console This is for debugging purposes

Learn More For further learning: https://www.w3schools.com/js/js_syntax.asp

Example Files https://www.cs.mtsu.edu/~crn2k/public/courses/1150/JavascriptExamples/c hooseColor.html https://www.cs.mtsu.edu/~crn2k/public/courses/1150/JavascriptExamples/cl ock.html https://www.cs.mtsu.edu/~crn2k/public/courses/1150/JavascriptExamples/h earts.html