The document provides an overview of jQuery and JavaScript concepts. It discusses:
1. What jQuery is and why it's useful, allowing developers to simplify common tasks with fewer lines of code.
2. How to access DOM elements using jQuery selectors, which are similar to CSS selectors. This allows selecting elements by name, ID, class, and other attributes.
3. Core JavaScript concepts like variables, data types, operators, and functions. It also covers variable scope, error handling, and working with objects.
This document provides an introduction to JavaScript including:
1. JavaScript is a client-side scripting language that adds interactivity to HTML pages. It is embedded directly into HTML and allows dynamic updating of content.
2. The document covers JavaScript syntax, variables, data types, functions, objects, arrays, strings, dates and more. It provides examples of how to declare variables, write functions, create objects and arrays, and manipulate strings and dates.
3. Methods for output, variable scope, and built-in objects like String, Array, Math and Date are described. The DOM (Document Object Model) and form validation using JavaScript are also mentioned.
This document provides an introduction and overview of jQuery. It discusses how jQuery simplifies DOM navigation and manipulation, handles browser differences, and makes JavaScript coding easier. The document covers basic jQuery concepts like selectors, the jQuery function, attributes, and events. It also provides examples of common jQuery code.
The document discusses jQuery and Ajax. It explains that jQuery is a JavaScript library that simplifies JavaScript programming and DOM manipulation. It allows selecting HTML elements and performing actions on them with simple syntax like $(selector).action(). Some key points made are:
- jQuery takes common tasks like AJAX calls and wraps them in simple methods.
- Popular features include HTML/CSS manipulation, events, effects/animations, and utilities.
- Major companies like Google use jQuery.
- jQuery works cross-browser and is easy to include via a script tag.
This document provides an overview of jQuery, including:
- What jQuery is and how it simplifies client-side scripting
- How to download and include the jQuery library
- Common jQuery syntax using selectors to find elements and perform actions
- How jQuery interacts with elements using the DOM and handles events
- How jQuery enables AJAX interactions to request and load data asynchronously
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
jQuery is a JavaScript library that simplifies HTML document manipulation and event handling. It allows developers to select elements, hide/show elements, and handle events with simple and concise code. jQuery animations and effects like fade, slide, and animate allow for creative transitions between states.
The document discusses using jQuery and custom data attributes to add client-side behavior and interactivity to Oracle APEX applications. It introduces:
- The data attribute for unambiguously identifying elements
- jQuery for element selection, event handling, and AJAX
- Changing page items to HTML5 input types using data attributes
- A rowclick plugin for adding click handling to report rows
- Record sorting in reports using jQuery sortable
- Deleting records from reports using click events and PL/SQL processing
The document provides code examples and discusses building interactive features like record sorting and deletion without custom coding.
This document provides an introduction to JavaScript including:
1. JavaScript is a client-side scripting language that adds interactivity to HTML pages. It is embedded directly into HTML and allows dynamic updating of content.
2. The document covers JavaScript syntax, variables, data types, functions, objects, arrays, strings, dates and more. It provides examples of how to declare variables, write functions, create objects and arrays, and manipulate strings and dates.
3. Methods for output, variable scope, and built-in objects like String, Array, Math and Date are described. The DOM (Document Object Model) and form validation using JavaScript are also mentioned.
This document provides an introduction and overview of jQuery. It discusses how jQuery simplifies DOM navigation and manipulation, handles browser differences, and makes JavaScript coding easier. The document covers basic jQuery concepts like selectors, the jQuery function, attributes, and events. It also provides examples of common jQuery code.
The document discusses jQuery and Ajax. It explains that jQuery is a JavaScript library that simplifies JavaScript programming and DOM manipulation. It allows selecting HTML elements and performing actions on them with simple syntax like $(selector).action(). Some key points made are:
- jQuery takes common tasks like AJAX calls and wraps them in simple methods.
- Popular features include HTML/CSS manipulation, events, effects/animations, and utilities.
- Major companies like Google use jQuery.
- jQuery works cross-browser and is easy to include via a script tag.
This document provides an overview of jQuery, including:
- What jQuery is and how it simplifies client-side scripting
- How to download and include the jQuery library
- Common jQuery syntax using selectors to find elements and perform actions
- How jQuery interacts with elements using the DOM and handles events
- How jQuery enables AJAX interactions to request and load data asynchronously
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
jQuery is a JavaScript library that simplifies HTML document manipulation and event handling. It allows developers to select elements, hide/show elements, and handle events with simple and concise code. jQuery animations and effects like fade, slide, and animate allow for creative transitions between states.
The document discusses using jQuery and custom data attributes to add client-side behavior and interactivity to Oracle APEX applications. It introduces:
- The data attribute for unambiguously identifying elements
- jQuery for element selection, event handling, and AJAX
- Changing page items to HTML5 input types using data attributes
- A rowclick plugin for adding click handling to report rows
- Record sorting in reports using jQuery sortable
- Deleting records from reports using click events and PL/SQL processing
The document provides code examples and discusses building interactive features like record sorting and deletion without custom coding.
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTAAFREEN SHAIKH
This document provides information about JavaScript including:
- JavaScript is a client-side scripting language used to make web pages dynamic. It was created by Brendan Eich at Netscape.
- There are two types of scripting languages - client-side (JavaScript, VBScript) and server-side (ASP, PHP, Perl). Client-side scripts run on the browser while server-side scripts run on the web server.
- JavaScript has various data types including strings, numbers, Booleans, undefined and null. It also has operators like arithmetic, comparison, logical and assignment operators.
- Functions, objects, and events are important concepts in JavaScript. Functions allow code to be reused, objects bundle data
This document provides an introduction to JavaScript, covering topics such as:
- The scope of the lesson includes an introduction to JavaScript, using JavaScript code, syntax, data types, objects, strings, functions, and standard popup boxes.
- JavaScript is a client-side scripting language that allows interactivity on web pages by modifying HTML content and handling events. It is interpreted by web browsers rather than compiled.
- JavaScript code can be embedded directly in HTML, or linked via external .js files, and is executed when the page loads or in response to events.
This document provides an outline and overview of client-side technologies including JavaScript, DOM, and jQuery. The outline covers JavaScript concepts like data types, control structures, arrays, functions, and objects. It also covers DOM levels and manipulating the DOM. Finally, it discusses jQuery and how to load, select elements, handle events, and more. The presentation aims to familiarize students with these important front-end technologies.
This document provides an outline and overview of client-side technologies including JavaScript, DOM, and jQuery. The outline includes sections on JavaScript concepts like data types, control structures, arrays, functions, and objects. It also covers DOM levels and manipulating the DOM, as well as introductions to jQuery for selecting elements, changing styles, and handling events. The presentation provides an overview of these key client-side technologies for students.
jQuery Selectors
jQuery selectors allow you to select and manipulate HTML element(s).
jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more. It's based on the existing CSS Selectors, and in addition, it has some own custom selectors.
All selectors in jQuery start with the dollar sign and parentheses: $().
What are Events?
All the different visitors' actions that a web page can respond to are called events.
An event represents the precise moment when something happens.
Examples:
moving a mouse over an element
selecting a radio button
clicking on an element
The term "fires/fired" is often used with events. Example: "The keypress event is fired, the moment you press a key".
This document provides an introduction to jQuery, including:
- What jQuery is and its main features like DOM manipulation, CSS manipulation, events, effects, animations, and AJAX.
- The benefits of jQuery like being browser independent and increasing coding speed.
- How to add jQuery to web pages by downloading the jQuery library, including the jQuery file, and writing jQuery code within script tags.
- jQuery selectors that allow selecting elements based on name, id, classes, attributes, and more. Common selectors include element, id, class, and universal selectors.
- jQuery events like click, change, submit, and how to attach event handler functions using methods like click(), change
JavaScript is the programming language of the web. It can dynamically manipulate HTML content by changing element properties like innerHTML. Functions allow JavaScript code to run in response to events like button clicks or timeouts. JavaScript uses objects and prototypes to define reusable behaviors and properties for objects. It is an important language for web developers to learn alongside HTML and CSS.
jQuery is a JavaScript library that simplifies HTML document traversal, event handling, animating, and Ajax interactions. It was created in 2006 with the goal of writing less code to do more. jQuery simplifies tasks like selecting elements, handling events, performing animations and AJAX calls to make web development faster.
JavaScript is a scripting language that allows adding interactivity to HTML pages. It can react to events, read and write HTML elements, validate data, detect the visitor's browser, create cookies, and more. The DOM defines a standard for accessing and manipulating HTML documents. JavaScript uses objects, functions, and prototypes for object-oriented programming. Key concepts include encapsulation, inheritance, and abstraction. Events follow the capturing and bubbling phases. JavaScript supports conditionals, loops, functions, scopes, closures, and more.
Javascript allows interactive content on web pages and control of the browser and document. It is an interpreted scripting language that is cross-platform but support varies. Javascript can provide interactive content, control document appearance and content, and interact with the user through event handlers.
This document provides an overview of Angular and TypeScript. It begins with an introduction to Angular and its features like cross-platform support, speed, productivity tools, and full development story. It then compares Angular, AngularJS, and React. Next it discusses tools like NodeJS, Angular CLI, and Visual Studio Code. It covers TypeScript fundamentals like data types, variables, functions, tuples, unions, interfaces, classes, namespaces and modules. It explains Angular architecture components like components, directives, routes, services and NgModule. Finally, it wraps up with a discussion of components in Angular and the topics that will be covered in the next session.
Mobile applications Development - Lecture 12
Javascript
jQuery (Zepto)
useful microframeworks
This presentation has been developed in the context of the Mobile Applications Development course at the Computer Science Department of the University of L’Aquila (Italy).
http://www.di.univaq.it/malavolta
This document provides an introduction to JavaScript and covers topics such as:
- JavaScript allows for interactivity on web pages by manipulating the browser and reacting to user actions.
- JavaScript code is embedded within HTML pages and executed on the client-side by the browser.
- Common JavaScript concepts covered include variables, functions, scope, events, and form validation.
- JavaScript can be used to validate user input, perform calculations, and modify the DOM in response to events.
This document provides an introduction and overview of jQuery. It discusses why jQuery is useful, unobtrusive JavaScript, fundamental jQuery elements and concepts like selectors and the jQuery wrapper. It also covers more advanced topics like query chains, advanced selectors, the document ready handler, extending jQuery, and using jQuery with other libraries. The document is intended to teach the basics of jQuery and how it can be used to select and manipulate elements on an HTML page.
This document provides a summary of jQuery, including:
- What jQuery is and why it is popular
- How to install and include the jQuery library
- Common jQuery syntax using selectors to select and manipulate HTML elements
- Examples of jQuery events, DOM traversal methods, and AJAX functionality
- Contact information is provided at the end for the training organization behind the document.
In JS: CLASS <=> Constructor FN
new FN() => FN() { this }
FN = CLASS (FN = FN, FN = DATA)
Objects
Prototype / __proto__
Inheritence
Rewriting / Augmenting
built in objects
- JavaScript code can be embedded in HTML files using <script> tags and is used to add dynamic and interactive behaviors to web pages. It is commonly used for form validation, dynamic HTML, and AJAX.
- Functions are commonly used in JavaScript to reuse code. Variables can be declared and used within functions and have limited scope. Operators, if/else statements, and loops allow for conditional logic.
- AJAX allows for asynchronous communication between the browser and server, improving interactivity. Cookies can be used to store small amounts of data on the client-side to remember information between requests.
jQuery is a JavaScript library that simplifies HTML document manipulation and event handling. It takes common tasks that require many lines of JavaScript code and wraps them into methods that can be called with a single line of code. Some key features of jQuery include HTML/DOM manipulation, CSS manipulation, event methods, effects/animations, and AJAX. jQuery selectors allow users to select HTML elements using CSS-style selectors and then perform actions on the selected elements. Common jQuery methods include click(), hide(), show(), toggle(), and fadeIn() which attach event handlers and modify element visibility with various effects.
JavaScript allows for dynamic web pages and client-side form validation. It is embedded in HTML using <script> tags and can be stored in external .js files. Functions are commonly used in JavaScript. If/else statements and operators allow for conditional logic. AJAX enables asynchronous communication with servers. Cookies store small amounts of data in a user's browser.
This document provides an introduction and overview of JavaScript. It begins with an explanation of what dynamic HTML (DHTML) is and its key technologies including HTML, CSS, JavaScript, and the DOM. It then discusses what JavaScript is, its advantages, and what it can do. The document outlines how JavaScript code can be implemented in web pages and describes basic JavaScript syntax including variables, data types, operators, and conditional and loop statements. It provides examples of JavaScript functions, events, and interacting with HTML elements.
The document provides an introduction to HTML5 including:
- The evolution of HTML from versions 1.0 to 5.0.
- The basic structure of an HTML5 document with tags like <html>, <head>, <body>, etc.
- Common text formatting tags in HTML5 like <h1>-<h6> for headings, <p> for paragraphs, and <br> for line breaks.
- How to set the font style using tags like <b>, <i>, <strong>, and <strike>.
The document provides information on dynamically accessing and manipulating web pages with JavaScript and jQuery. It discusses getting and setting element values, attributes, styles, sizes and positions. It also covers dynamically adding, removing, replacing and rearranging elements. Specific methods for these manipulations using jQuery are demonstrated through code examples, such as using html(), remove(), replaceWith(), after() and toggleClass(). The document also discusses interacting with the window, browser and screen objects.
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTAAFREEN SHAIKH
This document provides information about JavaScript including:
- JavaScript is a client-side scripting language used to make web pages dynamic. It was created by Brendan Eich at Netscape.
- There are two types of scripting languages - client-side (JavaScript, VBScript) and server-side (ASP, PHP, Perl). Client-side scripts run on the browser while server-side scripts run on the web server.
- JavaScript has various data types including strings, numbers, Booleans, undefined and null. It also has operators like arithmetic, comparison, logical and assignment operators.
- Functions, objects, and events are important concepts in JavaScript. Functions allow code to be reused, objects bundle data
This document provides an introduction to JavaScript, covering topics such as:
- The scope of the lesson includes an introduction to JavaScript, using JavaScript code, syntax, data types, objects, strings, functions, and standard popup boxes.
- JavaScript is a client-side scripting language that allows interactivity on web pages by modifying HTML content and handling events. It is interpreted by web browsers rather than compiled.
- JavaScript code can be embedded directly in HTML, or linked via external .js files, and is executed when the page loads or in response to events.
This document provides an outline and overview of client-side technologies including JavaScript, DOM, and jQuery. The outline covers JavaScript concepts like data types, control structures, arrays, functions, and objects. It also covers DOM levels and manipulating the DOM. Finally, it discusses jQuery and how to load, select elements, handle events, and more. The presentation aims to familiarize students with these important front-end technologies.
This document provides an outline and overview of client-side technologies including JavaScript, DOM, and jQuery. The outline includes sections on JavaScript concepts like data types, control structures, arrays, functions, and objects. It also covers DOM levels and manipulating the DOM, as well as introductions to jQuery for selecting elements, changing styles, and handling events. The presentation provides an overview of these key client-side technologies for students.
jQuery Selectors
jQuery selectors allow you to select and manipulate HTML element(s).
jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more. It's based on the existing CSS Selectors, and in addition, it has some own custom selectors.
All selectors in jQuery start with the dollar sign and parentheses: $().
What are Events?
All the different visitors' actions that a web page can respond to are called events.
An event represents the precise moment when something happens.
Examples:
moving a mouse over an element
selecting a radio button
clicking on an element
The term "fires/fired" is often used with events. Example: "The keypress event is fired, the moment you press a key".
This document provides an introduction to jQuery, including:
- What jQuery is and its main features like DOM manipulation, CSS manipulation, events, effects, animations, and AJAX.
- The benefits of jQuery like being browser independent and increasing coding speed.
- How to add jQuery to web pages by downloading the jQuery library, including the jQuery file, and writing jQuery code within script tags.
- jQuery selectors that allow selecting elements based on name, id, classes, attributes, and more. Common selectors include element, id, class, and universal selectors.
- jQuery events like click, change, submit, and how to attach event handler functions using methods like click(), change
JavaScript is the programming language of the web. It can dynamically manipulate HTML content by changing element properties like innerHTML. Functions allow JavaScript code to run in response to events like button clicks or timeouts. JavaScript uses objects and prototypes to define reusable behaviors and properties for objects. It is an important language for web developers to learn alongside HTML and CSS.
jQuery is a JavaScript library that simplifies HTML document traversal, event handling, animating, and Ajax interactions. It was created in 2006 with the goal of writing less code to do more. jQuery simplifies tasks like selecting elements, handling events, performing animations and AJAX calls to make web development faster.
JavaScript is a scripting language that allows adding interactivity to HTML pages. It can react to events, read and write HTML elements, validate data, detect the visitor's browser, create cookies, and more. The DOM defines a standard for accessing and manipulating HTML documents. JavaScript uses objects, functions, and prototypes for object-oriented programming. Key concepts include encapsulation, inheritance, and abstraction. Events follow the capturing and bubbling phases. JavaScript supports conditionals, loops, functions, scopes, closures, and more.
Javascript allows interactive content on web pages and control of the browser and document. It is an interpreted scripting language that is cross-platform but support varies. Javascript can provide interactive content, control document appearance and content, and interact with the user through event handlers.
This document provides an overview of Angular and TypeScript. It begins with an introduction to Angular and its features like cross-platform support, speed, productivity tools, and full development story. It then compares Angular, AngularJS, and React. Next it discusses tools like NodeJS, Angular CLI, and Visual Studio Code. It covers TypeScript fundamentals like data types, variables, functions, tuples, unions, interfaces, classes, namespaces and modules. It explains Angular architecture components like components, directives, routes, services and NgModule. Finally, it wraps up with a discussion of components in Angular and the topics that will be covered in the next session.
Mobile applications Development - Lecture 12
Javascript
jQuery (Zepto)
useful microframeworks
This presentation has been developed in the context of the Mobile Applications Development course at the Computer Science Department of the University of L’Aquila (Italy).
http://www.di.univaq.it/malavolta
This document provides an introduction to JavaScript and covers topics such as:
- JavaScript allows for interactivity on web pages by manipulating the browser and reacting to user actions.
- JavaScript code is embedded within HTML pages and executed on the client-side by the browser.
- Common JavaScript concepts covered include variables, functions, scope, events, and form validation.
- JavaScript can be used to validate user input, perform calculations, and modify the DOM in response to events.
This document provides an introduction and overview of jQuery. It discusses why jQuery is useful, unobtrusive JavaScript, fundamental jQuery elements and concepts like selectors and the jQuery wrapper. It also covers more advanced topics like query chains, advanced selectors, the document ready handler, extending jQuery, and using jQuery with other libraries. The document is intended to teach the basics of jQuery and how it can be used to select and manipulate elements on an HTML page.
This document provides a summary of jQuery, including:
- What jQuery is and why it is popular
- How to install and include the jQuery library
- Common jQuery syntax using selectors to select and manipulate HTML elements
- Examples of jQuery events, DOM traversal methods, and AJAX functionality
- Contact information is provided at the end for the training organization behind the document.
In JS: CLASS <=> Constructor FN
new FN() => FN() { this }
FN = CLASS (FN = FN, FN = DATA)
Objects
Prototype / __proto__
Inheritence
Rewriting / Augmenting
built in objects
- JavaScript code can be embedded in HTML files using <script> tags and is used to add dynamic and interactive behaviors to web pages. It is commonly used for form validation, dynamic HTML, and AJAX.
- Functions are commonly used in JavaScript to reuse code. Variables can be declared and used within functions and have limited scope. Operators, if/else statements, and loops allow for conditional logic.
- AJAX allows for asynchronous communication between the browser and server, improving interactivity. Cookies can be used to store small amounts of data on the client-side to remember information between requests.
jQuery is a JavaScript library that simplifies HTML document manipulation and event handling. It takes common tasks that require many lines of JavaScript code and wraps them into methods that can be called with a single line of code. Some key features of jQuery include HTML/DOM manipulation, CSS manipulation, event methods, effects/animations, and AJAX. jQuery selectors allow users to select HTML elements using CSS-style selectors and then perform actions on the selected elements. Common jQuery methods include click(), hide(), show(), toggle(), and fadeIn() which attach event handlers and modify element visibility with various effects.
JavaScript allows for dynamic web pages and client-side form validation. It is embedded in HTML using <script> tags and can be stored in external .js files. Functions are commonly used in JavaScript. If/else statements and operators allow for conditional logic. AJAX enables asynchronous communication with servers. Cookies store small amounts of data in a user's browser.
This document provides an introduction and overview of JavaScript. It begins with an explanation of what dynamic HTML (DHTML) is and its key technologies including HTML, CSS, JavaScript, and the DOM. It then discusses what JavaScript is, its advantages, and what it can do. The document outlines how JavaScript code can be implemented in web pages and describes basic JavaScript syntax including variables, data types, operators, and conditional and loop statements. It provides examples of JavaScript functions, events, and interacting with HTML elements.
The document provides an introduction to HTML5 including:
- The evolution of HTML from versions 1.0 to 5.0.
- The basic structure of an HTML5 document with tags like <html>, <head>, <body>, etc.
- Common text formatting tags in HTML5 like <h1>-<h6> for headings, <p> for paragraphs, and <br> for line breaks.
- How to set the font style using tags like <b>, <i>, <strong>, and <strike>.
The document provides information on dynamically accessing and manipulating web pages with JavaScript and jQuery. It discusses getting and setting element values, attributes, styles, sizes and positions. It also covers dynamically adding, removing, replacing and rearranging elements. Specific methods for these manipulations using jQuery are demonstrated through code examples, such as using html(), remove(), replaceWith(), after() and toggleClass(). The document also discusses interacting with the window, browser and screen objects.
This document discusses algorithms for learning sets of rules from data. It covers sequential covering algorithms which learn one rule at a time to incrementally grow a set of rules. It also discusses learning first-order rules using algorithms like FOIL, which extend this approach to handle variables. FOIL performs a general-to-specific search to learn each rule, generating candidate specializations by adding literals involving variables already in the rule. The document compares different evaluation functions and search strategies for learning single rules and sets of rules from data.
This document discusses instance-based learning methods and genetic algorithms. It provides details on k-nearest neighbor classification, locally weighted regression, and case-based reasoning as instance-based learning methods. It also describes the basic process of genetic algorithms, including representing hypotheses as bit strings, evaluating fitness, and using genetic operators like crossover and mutation to generate new hypotheses.
This document provides an overview of artificial neural networks and the backpropagation algorithm. Some key points:
- Artificial neural networks (ANNs) are composed of densely interconnected simple units that can learn real-valued functions from examples using algorithms like backpropagation.
- Backpropagation uses gradient descent to minimize error between network outputs and targets by adjusting network parameters (weights and biases).
- Multilayer networks with sigmoid units in hidden layers can represent nonlinear functions, unlike single perceptrons which are limited to linear separability.
- The backpropagation algorithm employs gradient descent over the entire network, computing error derivatives layer-by-layer to update weights to minimize overall error.
This document provides an overview of Bayesian learning. It discusses key concepts like Bayes theorem, maximum likelihood hypotheses, minimum description length principle, Bayes optimal classifiers, and Gibbs algorithm. Bayes theorem allows calculating the posterior probability of a hypothesis given observed data and prior probabilities. The maximum likelihood hypothesis is the one that maximizes the likelihood of the data. The minimum description length principle selects the hypothesis that minimizes the total description length of the hypothesis and data. A Bayes optimal classifier combines predictions of multiple hypotheses weighted by their probabilities to classify new instances. The Gibbs algorithm makes predictions by randomly selecting hypotheses based on their posterior probabilities.
The document discusses machine learning and concept learning. It provides details about:
1. The key components in designing a machine learning system, including choosing the training experience, target function, representation, and learning algorithm.
2. Concept learning tasks involve learning concepts or categories from examples to classify new examples.
3. Concept learning can be viewed as a search through the hypothesis space to find the hypothesis that best fits the training examples given the representation.
1) The document discusses connecting to MySQL databases and performing common operations like creating, selecting, updating, and deleting data from MySQL tables using PHP.
2) Key points covered include how to connect to a MySQL database, using SQL statements to create/drop databases and tables, and fetch data using functions like mysqli_query(), mysqli_fetch_array().
3) Examples demonstrate how to create a database and table, insert, update, and delete records, and display table data in HTML tables by mapping database columns to HTML table cells.
This document provides an overview of regular expressions, sessions, and cookies in PHP. It discusses PHP functions for manipulating arrays, including sorting, merging, reversing, and randomizing arrays. It also covers tokenizing strings using functions like strtok() and explode(), and parsing strings with implode(). The document explains how to use regular expressions in PHP for pattern matching in strings. Sessions in PHP allow storing and retrieving user data on the server side, while cookies store small amounts of data on the client side.
The document discusses object-oriented programming concepts in PHP including classes, objects, inheritance, encapsulation, and polymorphism. It provides examples of defining classes, creating objects, accessing properties and methods, constructors, destructors, inheritance, overriding methods, scopes, interfaces, constants, abstract classes, and calling parent functions. The document is an introduction to object-oriented programming in PHP and covers the basic syntax and constructs.
The document discusses object-oriented programming concepts in PHP including classes, objects, inheritance, encapsulation, and polymorphism. It provides examples of defining classes, creating objects, accessing properties and methods, constructors, destructors, inheritance, overriding methods, scopes, interfaces, constants, abstract classes, and calling parent functions. Key concepts are explained like public, private, and protected access modifiers, abstract classes and methods, and using parent, self and static keywords.
The document provides information about PHP (Hypertext Preprocessor), an open-source scripting language commonly used for web development. It discusses that PHP code is embedded within HTML and is executed on the server-side to generate dynamic web page content. The document outlines PHP's syntax, variables, data types, output functions, expressions, and control structures. It provides examples of comments, variables, operators, and functions in PHP.
This document discusses strings and arrays in PHP. It covers string functions like strlen(), strpos(), and substr() for inspecting, comparing, and manipulating strings. It also covers creating, accessing, and iterating through arrays, including multidimensional arrays. Functions like count(), current(), next(), reset(), and foreach are described for working with arrays. The document also introduces numerical types in PHP like integers and floats.
This document provides an overview of PHP (Hypertext Preprocessor), a widely-used open source scripting language commonly used for web development. It discusses key PHP concepts like syntax, variables, data types, output, expressions, branching, looping, and functions. Specifically, it explains that PHP code is placed within <?php ?> tags, variables are prefixed with $, and common data types include integers, doubles, booleans, strings, and arrays. It also covers PHP operators, control structures like if/else and switch statements, and different types of loops. The document provides examples to illustrate PHP syntax and built-in functions.
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
A review on techniques and modelling methodologies used for checking electrom...nooriasukmaningtyas
The proper function of the integrated circuit (IC) in an inhibiting electromagnetic environment has always been a serious concern throughout the decades of revolution in the world of electronics, from disjunct devices to today’s integrated circuit technology, where billions of transistors are combined on a single chip. The automotive industry and smart vehicles in particular, are confronting design issues such as being prone to electromagnetic interference (EMI). Electronic control devices calculate incorrect outputs because of EMI and sensors give misleading values which can prove fatal in case of automotives. In this paper, the authors have non exhaustively tried to review research work concerned with the investigation of EMI in ICs and prediction of this EMI using various modelling methodologies and measurement setups.
International Conference on NLP, Artificial Intelligence, Machine Learning an...gerogepatton
International Conference on NLP, Artificial Intelligence, Machine Learning and Applications (NLAIM 2024) offers a premier global platform for exchanging insights and findings in the theory, methodology, and applications of NLP, Artificial Intelligence, Machine Learning, and their applications. The conference seeks substantial contributions across all key domains of NLP, Artificial Intelligence, Machine Learning, and their practical applications, aiming to foster both theoretical advancements and real-world implementations. With a focus on facilitating collaboration between researchers and practitioners from academia and industry, the conference serves as a nexus for sharing the latest developments in the field.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
Embedded machine learning-based road conditions and driving behavior monitoringIJECEIAES
Car accident rates have increased in recent years, resulting in losses in human lives, properties, and other financial costs. An embedded machine learning-based system is developed to address this critical issue. The system can monitor road conditions, detect driving patterns, and identify aggressive driving behaviors. The system is based on neural networks trained on a comprehensive dataset of driving events, driving styles, and road conditions. The system effectively detects potential risks and helps mitigate the frequency and impact of accidents. The primary goal is to ensure the safety of drivers and vehicles. Collecting data involved gathering information on three key road events: normal street and normal drive, speed bumps, circular yellow speed bumps, and three aggressive driving actions: sudden start, sudden stop, and sudden entry. The gathered data is processed and analyzed using a machine learning system designed for limited power and memory devices. The developed system resulted in 91.9% accuracy, 93.6% precision, and 92% recall. The achieved inference time on an Arduino Nano 33 BLE Sense with a 32-bit CPU running at 64 MHz is 34 ms and requires 2.6 kB peak RAM and 139.9 kB program flash memory, making it suitable for resource-constrained embedded systems.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELgerogepatton
As digital technology becomes more deeply embedded in power systems, protecting the communication
networks of Smart Grids (SG) has emerged as a critical concern. Distributed Network Protocol 3 (DNP3)
represents a multi-tiered application layer protocol extensively utilized in Supervisory Control and Data
Acquisition (SCADA)-based smart grids to facilitate real-time data gathering and control functionalities.
Robust Intrusion Detection Systems (IDS) are necessary for early threat detection and mitigation because
of the interconnection of these networks, which makes them vulnerable to a variety of cyberattacks. To
solve this issue, this paper develops a hybrid Deep Learning (DL) model specifically designed for intrusion
detection in smart grids. The proposed approach is a combination of the Convolutional Neural Network
(CNN) and the Long-Short-Term Memory algorithms (LSTM). We employed a recent intrusion detection
dataset (DNP3), which focuses on unauthorized commands and Denial of Service (DoS) cyberattacks, to
train and test our model. The results of our experiments show that our CNN-LSTM method is much better
at finding smart grid intrusions than other deep learning algorithms used for classification. In addition,
our proposed approach improves accuracy, precision, recall, and F1 score, achieving a high detection
accuracy rate of 99.50%.
2. Contents
Query and JavaScript Syntax – Understanding and Using JavaScript
Objects - Accessing DOM Elements Using JavaScript and jQuery
Objects – Navigating and Manipulating jQuery Objects and DOM
Elements with jQuery – Applying JavaScript and jQuery Events for
Richly Interactive Web Pages.
3. Query and JavaScript Syntax
1. Adding jQuery and JavaScript to a Web Page
2. Accessing the DOM
3. Understanding JavaScript Syntax
What is jQuery?
● jQuery is a lightweight, "write less, do more", JavaScript library.
● jQuery greatly simplifies JavaScript programming.
● The purpose of jQuery is to make it much easier to use JavaScript on your website.
● jQuery takes a lot of common tasks that require many lines of JavaScript code to
accomplish, and wraps them into methods that you can call with a single line of code.
● jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and
DOM manipulation.
4. The jQuery library contains the following features:
● HTML/DOM manipulation
● CSS manipulation
● HTML event methods
● Effects and animations
● AJAX
● Utilities
Why jQuery?
There are lots of other JavaScript libraries out there, but jQuery is probably the most
popular, and also the most extendable.
Many of the biggest companies on the Web use jQuery, such as:
● Google
● Microsoft
● IBM
● Netflix
5. 1.Adding jQuery and JavaScript to a Web Page
Loading the jQuery Library
<script> tag is used to load the jQuery into your web page.
There are several ways to start using jQuery on your web site. You can:
● Download the jQuery library from jQuery.com
● Include jQuery from a CDN, like Google
● In the following statements, The first loads it from the jQuery CDN
source and the second loads it from the web server
○ <script src="http://code.jquery.com/jquery-latest.min.js"></script>
○ <script src="includes/js/jquery-latest.min.js"></script>
6. Implementing Your Own jQuery and JavaScript
● A pair of <script> statements that load jQuery and then use it.
● The document.write() function just writes text directly to the browser to be
rendered:
<script src="http://code.jquery.com/jquery-latest.min.js">
</script>
<script>
function writeIt(){
document.write("jQuery Version " + $().jquery + "
loaded.");
}
</script>
7. Accessing HTML Event Handlers
● Each supported event is an attribute of the object that is receiving the
event.
● If you set the attribute value to a JavaScript function, the browser will
execute your function when the event is triggered.
9. 2.Accessing the DOM
Using Traditional JavaScript to Access the DOM
● Traditionally, JavaScript uses the global document object to access
elements in the web page.
● The simplest method of accessing an element is to directly refer to it by
id with help of getElementById() function
● Another helpful JavaScript function is getElementsByTagName() which
is used to access the DOM elements
● This returns a JavaScript array of DOM elements that match the tag
name.
11. Using jQuery Selectors to Access HTML Elements
● Accessing HTML elements is one of jQuery’s biggest strengths.
● jQuery uses selectors that are very similar to CSS selectors to access one or more
elements in the DOM;
● Query selectors are used to select and manipulate HTML element(s).
● jQuery selectors are used to "find" (or select) HTML elements based on their name, id,
classes, types, attributes, values of attributes and much more
● All selectors in jQuery start with the dollar sign and parentheses: $().
○ Element selector
○ #id selector
○ .class selector
12. Element selector
● The jQuery element selector selects elements based on the element name.(example:$("p"))
● Example:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").css("color", "red");
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>change color</button>
</body>
</html>
13. #id selector
● The jQuery #id selector uses the id attribute of an HTML tag to find the specific
element.(example:$("#test"))
● Example:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#p1").css("background-color", "yellow");
});
});
</script>
</head>
<body>
<p id="p1">welcome</p>
<button>change color</button>
</body>
</html>
14. Class selector
● The jQuery .class selector finds elements with a specific class.(example:$(".test"))
● Example:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$(".test").css({"background-color": "yellow", "font-size": "200%"});
});
</script>
</head>
<body>
<p class="test">Welcome</p>
</body></html>
15. 3.Understanding JavaScript Syntax
Creating Variables
● Variables are containers for storing data and access data from your
JavaScript files.
● Variables can point to simple data types, such as numbers or strings, or
they can point to more complex data types, such as objects.
● var keyword is used to define a variable in JavaScript
● Example:
○ var myString = "Some Text";
16. Understanding JavaScript Data Types
● String—Stores character data as a string.
○ The character data is specified by either single or double quotes.
○ var myString = 'Some Text';
○ var anotherString = "Some Other Text";
● Number—Stores the data as a numerical value
○ Example
■ var myInteger = 1;
■ var cost = 1.33;
● Boolean—Stores a single bit that is either true or false.
○ Booleans are often used for flags.
○ var yes = true;
○ var no = false;
● Array—An indexed array is a series of separate distinct data items all stored under a
single variable name
○ var arr = ["one", "two", "three"]
○ var first = arr[0];
17. ● Associative Array/Objects
○ An associative array is an array with string keys rather than numeric keys. Associative arrays
are dynamic objects that the user redefines as needed.
○ var obj = {"name":"Brad", "occupation":"Hacker", "age","Unknown"};
○ var name = obj.name;
Using Operators
● Arithmetic Operators(=,+,-,/,*,+=,-=,*=,/=,%=)
● Comparison Operators(==,!=,>,>=,<,<=,===,!=,&&,!!,!)
Conditional statements
● if statement
● if-else statement
● Nested if statement
● Switch case
18. Looping statements
● while loops
● do while loops
● for loops
● for in loops
Creating functions
● Defining Functions
○ Functions are defined using the keyword function followed by a function name that
describes the use of the function, list of zero or more arguments in () parentheses, and a
block of one or more code statements in {} brackets.
● Passing Variables to Functions
● Returning Values from Functions
20. Understanding Variable Scope
● Each identifier in a program also has a scope.
● Global variables or script-level variables that are declared in the head element are
accessible in any part of a script and are said to have global scope
● Identifiers declared inside a function have function (or local) scope and can be
used only in that function.
● If a local variable in a function has the same name as a global variable, the global
variable is “hidden” from the body of the function.
21. <!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>scope</title>
<script>
var x = 1;// global scope
function start()
{
functionA();
functionB();
functionA();
functionB();
}
function functionA()
{
var x = 25;//local scope
document.writeln("the value of x is"+x+"<br>");
x++;
document.writeln("the value of x is"+x+"<br>");
}
function functionB()
{
document.writeln("the value of x is"+x+"<br>");
x = x*10;
document.writeln("the value of x is"+x+"<br>");
}
start();
</script>
</head><body>
</body>
</html>
22. Adding Error Handling
● The try statement defines a code block to run (to try).
● The catch statement defines a code block to handle any error.
● The finally statement defines a code block to run regardless of the result.
● The throw statement defines a custom error.
24. Understanding and Using JavaScript Objects
1. Using object syntax
2. Understanding Built-in Objects
3. Creating Custom-Defined Objects
1.Using object syntax
Object
● An object is really a container to group multiple values and, in some instances, functions
together.
● The values of an object are called properties, and functions are called methods.
25. Creating a New Object Instance
● Object instances are created using the new keyword with the object constructor name.
For example, to create a Number object, you use the following line of code:
○ var x = new Number("5");
Accessing Object Properties
● All JavaScript objects have values that are accessible via a standard dot-naming syntax.
● For example, consider an object with the variable name user that contains a property
firstName.
○ user.FirstName
Accessing Object Methods
● An object method is a function that is attached to the object as a name. The function can
be called by using the dot syntax to reference the method name
○ user.getFullName()
28. String
● JavaScript automatically creates a String object anytime you define a
variable that has a string data type
● var myStr = "Welcome";
29. <!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<script>
var text = "HELLO WORLD";
var text1 = "sea";
var text2 = "food";
let text3 = "Hello planet earth, you are a great planet";
var letter = text.charAt(0);
document.write(letter+"<br>");
var code = text.charCodeAt(0);
document.write(code+"<br>");
var result = text1.concat(text2);
document.write(result+"<br>");
var mytext = String.fromCharCode(65);
document.write(mytext+"<br>");
let r = text3.indexOf("planet");
document.write(r+"<br>");
let r1 = text3.lastIndexOf("planet");
document.write(r1);
</script>
</body>
</html>
30.
31.
32. <!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<script>
let text = "The rain in SPAIN stays mainly in the plain";
let result = text.match(/rain/);
document.write(result+"<br>");
document.write(text.replace("SPAIN", "London")+"<br>");
document.write(text.search("rain")+"<br>");
document.write(text.slice(0,5)+"<br>");
document.write(text.split(" ",3)+"<br>");
document.write(text.substr(4, 3)+"<br>");
document.write(text.substring(1, 4));
</script>
</body>
</html>
33. Array
● The Array object provides a means of storing and handling a set of other objects.
Arrays can store numbers, strings, or other JavaScript
var arr = ["one", "two", "three"];
37. Date
The Date object provides access to the current time on the browser’s
system
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Dates</h1>
<script>
const d = new Date();
document.write(d)
</script>
</body>
</html>
38.
39.
40.
41. <!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>Date Object Methods</title>
<script type="text/javascript">
var current = new Date();
document.write("<h1>String representations and valueOf</h1>");
document.write("<br>toString:"+current.toString());
document.write("<br>toLocaleString:"+current.toLocaleString());
document.write("<br>toUTCString:"+current.toUTCString());
document.write("<br>valueOf:"+current.valueOf());
42. document.write("<h1>Get methods for local time zone</h1>");
document.write("<br>getDate:"+current.getDate());
document.write("<br>getDay:"+current.getDay());
document.write("<br>getMonth:"+current.getMonth());
document.write("<br>getFullYear:"+current.getFullYear());
document.write("<br>getTime:"+current.getTime());
document.write("<br>getHours:"+current.getHours());
document.write("<br>getMinutes:"+current.getMinutes());
document.write("<br>getSeconds:"+current.getSeconds());
document.write("<br>getMilliseconds:"+current.getMilliseconds());
document.write("<br>getTimezoneOffset:"+current.getTimezoneOffset());
43. document.write("<h1>Specifying arguments for a new Date</h1>");
var anotherDate = new Date( 2021, 3, 18, 1, 5, 0, 0 );
document.write(anotherDate);
</script>
<body>
</body>
</html>
44.
45. Math
The Math object is really an interface to a mathematical library that provides a
ton of time-saving functionality
<!DOCTYPE html>
<html>
<head>
<title> math object</title>
<meta charset="UTF-8">
<script type="text/javascript">
var result = Math.sqrt( 900 );
document.write(result);
</script>
<body>
</body></html>
48. RegExp
● When dynamically processing user input or even data coming back
from the web server, an important tool is regular expressions.
● Regular expressions allow you to quickly match patterns in text and
then act on those patterns.
● var re =/pattern/modifiers;
● Available modifiers in JavaScript
i—Perform matching that is not case sensitive.
g—Perform a global match on all instances rather than just the
first.
m—Perform multiline match
49. <!DOCTYPE html>
<html>
<body>
<h2>JavaScript Regular Expressions</h2>
<script>
var myStr = "Teach Yourself jQuery & JavaScript in 24 Lessons";
var re = /yourself/i;
var newStr = myStr.replace(re, "Your Friends");
document.write(newStr);
</script>
</body>
</html>
50. 3.Creating Custom-Defined Objects
● Objects are variables too. But objects can contain many values.
● Object values are written as name : value pairs (name and value separated by a
colon).
● var user = new Object();
○ user.first="Brad";
○ user.last="Dayley";
● var user = {'first':'Brad','last':'Dayley'};
● document.write(user.first + " " + user.last);
51. Adding Methods to JavaScript Objects
<html>
<body>
<h2>JavaScript Objects</h2>
<script>
var user = new Object();
user.first="abi";
user.last="karthi";
user.getFullName = makeFullName;
var user2 = {
'first':'john',
'last':'David',
'getFullName':makeFullName
};
function makeFullName()
{
return this.first + " " + this.last;
}
var user3 = {
first: "John",
last: "Peter",
getFullName : function() {
return this.first + " " + this.last;
}
};
53. Using a Prototyping Object Pattern→ The prototyping pattern is implemented
by defining the functions inside the prototype attribute of the object instead of the
object itself.
<html>
<body>
<h1> Using a Prototyping Object Pattern </h1>
<script>
function User(first, last){
this.first = first;
this.last = last;
}
User.prototype = {
getFullName: function(){
return this.first + " " + this.last;
}
};
var user1 = new User("John", "Peter");
document.write(user1.getFullName());
</script>
</body>
</html>
54. Accessing DOM Elements Using JavaScript and jQuery
Objects
1. Understanding DOM Objects Versus jQuery Objects
2. Accessing DOM Objects from JavaScript
3. Using jQuery Selectors
55. 1.Understanding DOM Objects Versus jQuery Objects
Javascript DOM objects
● In a web page, DOM (Document Object Model) objects refer to the objects that
represent the elements in the page's HTML source code.
● These objects can be manipulated using JavaScript, and can be accessed and modified
using the DOM API (Application Programming Interface).
● The DOM API provides a number of functions and properties that allow you to access
and modify DOM objects.
● For example, you can use the getElementById function to get a reference to an
element with a specific id, or you can use the innerHTML property to get or set the
HTML content of an element.
56. Drawbacks
● Complexity: The DOM API can be complex to work with, as it requires you to navigate the
hierarchical structure of the DOM and access elements using a variety of functions and
properties.
● Browser compatibility: The DOM API can vary between different browsers, which can make it
more challenging to write code that works consistently across different browsers.
● Performance: Modifying the DOM can be computationally intensive, as it requires the browser
to update the layout and rendering of the page.
These challenges can be mitigated to some extent by using tools such as the jQuery library, which
provides a more consistent and convenient interface for working with DOM objects.
57. list of some of the important attributes and methods of DOM objects
60. <script>
let name = document.getElementById("myLI").parentNode.nodeName;
document.getElementById("demo").innerHTML = "parent node is "+name;
const nodeList = document.getElementById("u1").children;
document.getElementById("demo1").innerHTML =nodeList.length;
const nodeList1 = document.getElementById("u1").childNodes;
document.getElementById("demo2").innerHTML =nodeList1.length;
</script>
</body>
</html>
61.
62. Example:(outerhtml)
<html>
<body>
<h2>The outerHTML Property</h2>
<p id="myP">I am a paragraph! Click "Change" to replace me with a header.</p>
<button onclick="myFunction()">Change</button>
<script>
function myFunction() {
const element = document.getElementById("myP");
element.outerHTML = "<h2>This is a h2 element.</h2>";
}
</script>
</body>
</html>
63.
64. Example:(getattribute)
<html>
<head>
<style>
.democlass {
color: red;
}
</style>
<script>
function myFunction() {
var x = document.getElementById("a").getAttribute("class");
document.getElementById("demo").innerHTML = x;
}
</script>
</head>
<body>
<h1 id="a" class="democlass">Hello World</h1>
<input type="submit" value="click to get the attribute" onclick="myFunction()">
<p id="demo"></p>
</body>
</html>
66. Example:(appendchild)
<html>
<body>
<p id="p2">This is another paragraph.</p>
<script>
var para = document.createElement("p");
var node = document.createTextNode("This is new.");
para.appendChild(node);
var element = document.getElementById("p2");
element.appendChild(para);
</script>
</body>
</html>
67. jQuery Objects
● jQuery objects are basically wrapper objects around a set of DOM elements.
● jQuery objects are objects created by the jQuery library, which is a JavaScript
library for simplifying HTML document traversal, event handling, and animating.
● jQuery objects are collections of DOM (Document Object Model) elements that can be
manipulated using the functions and methods provided by the jQuery library.
● Query objects are designed to be more convenient to work with than DOM objects, as
they provide a simpler and more consistent interface for manipulating elements in the
page.
68. Advantages
● Simplicity: jQuery objects provide a simple and consistent interface for interacting
with DOM elements, which can make it easier to write and maintain code that
manipulates these elements.
● Browser compatibility: jQuery objects abstract away many of the differences between
different browsers, which can make it easier to write code that works consistently
across different browsers.
● Convenience: jQuery objects provide a wide range of functions and methods for
manipulating DOM elements, which can make it easier to perform common tasks such as
selecting elements, modifying their attributes or styles, or handling events.
● Performance: jQuery is designed to be efficient and fast, and can often perform tasks
such as DOM manipulation more quickly than equivalent code using the DOM API.
69. List of some of the important methods of jQuery objects
78. 2.Accessing DOM Objects from JavaScript
Finding DOM Objects by ID
● The simplest is to find an HTML element using the value of the id
attribute using the getElementById(id) function.
● getElementById(id) searches the DOM for an object with a atching id
attribute.
80. Finding DOM Objects by Class Name
The getElementsByClassName() method returns a collection of child elements with
a given class name.
<html>
<body>
<h2>The getElementsByClassName() Method</h2>
<div class="example">Element1</div>
<div class="example">Element2</div>
<script>
collection = document.getElementsByClassName("example");
collection[0].innerHTML = "Hello World!";
</script>
</body>
</html>
81. Finding DOM Objects by Tag Name
● Another way to search for HTML elements is by their HTML tag, using the
getElementsByTagName(tag).
● This function returns a list of DOM objects with matching HTML tags
<html>
<body>
<h2>The getElementsByTagName() Method</h2>
<p>This is a paragraph.</p>
<script>
document.getElementsByTagName("p")[0].innerHTML = "Hello World!";
</script>
</body>
</html>
83. Applying Basic Selectors
● The most commonly used selectors are the basic ones.
● The basic selectors focus on the id attribute, class attribute, and tag
name of HTML elements
84. Class selector
● The jQuery .class selector finds elements with a specific class.(example:$(".test"))
● Example:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$(".test").css({"background-color": "yellow", "font-size": "200%"});
});
</script>
</head>
<body>
<p class="test">Welcome</p>
</body></html>
85. #id selector
● The jQuery #id selector uses the id attribute of an HTML tag to find the specific
element.(example:$("#test"))
● Example:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#p1").css("background-color", "yellow");
});
});
</script>
</head>
<body>
<p id="p1">welcome</p>
<button>change color</button>
</body>
</html>
86.
87. Element selector
● The jQuery element selector selects elements based on the element name.(example:$("p"))
● Example:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").css("color", "red");
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>change color</button>
</body>
</html>
88. Applying Attribute Selectors
● Another way to use jQuery selectors is to select HTML elements by their attribute
values
● Attribute values are denoted in the selector syntax by being enclosed in [] brackets
92. <body>
<h1 class="leftContent">Welcome to</h1>
<h1 class="rightContent">Fruit shop</h1>
Who is your favourite fruit:
<ul id="choose">
<li>Apple</li>
<li>Orange</li>
<li>banana</li>
</ul>
<p id="m" class="menu"> Thank you </p>
<p id="m1" class="menu1"> visit again </p>
</body>
</html>
93. Applying Content Selectors
● Another set of useful jQuery selectors are the content filter selectors.
● These selectors are used to select HTML elements based on the content inside
the HTML element
96. <body>
<h1>Welcome to the shop</h1>
<p>The list of fruits are</p>
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
<div>choose your <span>favorite </span></div>
</body>
</html>
97. Applying Hierarchy Selectors
● An important set of jQuery selectors are the hierarchy selectors.
● These selectors are used to select HTML elements based on the DOM hierarchy.
101. <body>
<div><h1>Welocme to <span>KEC </span>Engg College</p></div>
<div class="menu"> PG Department:<span> MSC(SS)</span> </div>
<form>
<label>search:</label>
<input type="text" class="item">
</form>
<div> Other departments are </div>
<ul id="menu">
<li> CSE </li>
<li>IT </li></ul>
<div> Thank you!!! </div>
<div> visit again </div>
</ul></body></html>
102. Applying Form Selectors
● An extremely useful set of selectors when working with dynamic HTML forms are
the form jQuery selectors.
● These selectors are used to select elements in the form based on the state of the
form element
106. Applying Visibility Selectors
● The visibility selectors are used to to control the flow and interactions of the
web page components and it selects the HTML elements that are hidden or visible
108. <body>
<h1>This is a heading</h1>
<p>This is a pargraph.</p>
<p>This is another paragraph.</p>
<h2 style="visibility:hidden;">This is a hidden paragraph.</h2>
<p style="display:none;">This is a hidden paragraph that is slowly shown.</p>
</body>
</html>
109. Applying Filtered Selectors
● Filtered selectors append a filter on the end of the selector statement that limits
the results returned by the selector
113. <body>
<h1> Welcome to the shop </h1>
<div> select the fruits </div>
<ul>
<li>Apple </li>
<li>Orange </li>
<li>banana </li>
<li>grape </li>
</ul>
<div> Thank you </div>
</body>
</html>
114. Navigating and Manipulating jQuery Objects and DOM Elements with
jQuery
1. Chaining jQuery Object Operations
2. Filtering the jQuery Object Results
3. Traversing the DOM Using jQuery Objects
4. Looking at Some Additional jQuery Object Methods
115. 1.Chaining jQuery Object Operations
Chaining allows us to run multiple jQuery methods (on the same element)
within a single statement.
Advantages:
While using method chaining in jQuery, it ensures that there is no need
to use the same selector more than once
117. 2.Filtering the jQuery Object Results
● jQuery objects provide a good set of methods which are used to alter
the DOM objects represented in the query.
121. <body>
<h1>Welcome to <span class="menu">My College</span></h1>
<h1 class="menu">Departments</h1>
<p>BSC</p>
<p class="intro">MSC</p>
<p>CSE</p>
<p>IT</p>
<h1>Programming languages to learn</h1>
<ul>
<li>C</li>
<li>C++</li>
<li>JAVA</li>
</ul></body></html>
122. 3.Traversing the DOM Using jQuery Objects
● Another important set of methods attached to the jQuery object are
the DOM traversing methods.
● DOM traversal is used to select elements based on their relationship to
other elements.
● The DOM is referred to as the DOM tree because it is organized in a
tree structure, with the document as the root and nodes that can have
both parents, siblings, and children.
126. <body> <h1> Welcome to the shop </h1>
<div>
<h2> List of fruits </h2>
<h3>
<span>name of the fruits</span></h3>
<div>
<p> apple</p>
<p>orange</p>
</div>
<h1> Thank you </h1>
</div>
</body>
</html>
128. <body> <h1> Welcome to the shop </h1>
<div>
<h2> List of fruits </h2>
<h3><span>name of the fruits</span></h3>
<div>
<h4>
<p> apple</p>
<p>orange</p>
</h4>
</div>
<h1> <span>Thank you </span></h1>
</div>
</body></html>
149. <body>
<button>Alert the value of each list item</button>
<ul>
<li>Coffee</li>
<li>Milk</li>
<li>Soda</li>
</ul>
<div>
<h1> list of fruits are </h1>
<p> apple </p>
<p> orange </p>
<p> banana </p>
</div>
</body></html>
153. Applying JavaScript and jQuery Events for Richly Interactive Web
Pages
1. Understanding Events
2. Using the Page Load Events for Initialization
3. Adding and Removing Event Handlers to DOM Elements
4. Triggering Events Manually
5. Creating Custom Events
6. Implementing Callbacks
154. 1.Understanding Events
● An event represents the precise moment when something happens.
● The following list describes the important things that happen when a user
interacts with the web page or browser window.
1. A physical event happens—A physical event occurs; for example, a user
clicks or moves the mouse or presses a key.
2. Events are triggered in the browser—The user interaction results in
events being triggered by the web browser—often, multiple events at the
same time.
For example, when a user types a key on the keyboard, three events are
triggered: the keypressed, keydown, and keyup events
3. The browser creates an object for the event
155. 4.User event handlers are called
● Handlers are created in JavaScript that will interact with the event objects.
● There are three phases
○ Capturing→ The capturing phase is on the way down to the target
HTML element from the document directly through each of the parent
elements.
■ By default, behavior for event handlers for the capturing phase is
disabled.
○ Target—The target phase occurs when the event is in the HTML element
where it was initially triggered.
○ Bubbling—The bubbling phase is on the way up through each of the
parents of the target HTML element, all the way back to the document.
■ By default, the bubbling phase is enabled for events.
156.
157. 5.Browser handlers are called
● In addition to user event handlers, the browser has default
handlers that do different things based on the event that was
triggered.
● For example, when the user clicks a link, the browser has an event
handler that gets called and navigates to the href location
specified in the link.
158. Event objects
Event objects get created by the browser when it detects that an
event has occurred
Javascript and jQuery event object attributes
166. 2.Using the Page Load Events for Initialization
Using the JavaScript onload Event
<html>
<body onload="myFunction()">
<script>
function myFunction() {
alert("Page is loaded");
}
</script>
</body>
</html>
167. Adding Initialization Code in jQuery
1.ready() jQuery method
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$("h1").css("color","red");
});
</script>
</head>
<body>
<h1> welcome to the website </h1>
</body>
</html>
168. 2.load() jQuery method
● Using the .load() jQuery method will trigger the initialization code to
run after all page resources have loaded and are rendered to the
User.
● The load() method deprecated in jQuery version 1.8. It was
completely removed in version 3.0.
169. 3.Adding and Removing Event Handlers to DOM Elements
An event handler is a JavaScript function that adds, removes, or alters DOM elements
Adding Event Handlers in JavaScript
● To add an event handler in JavaScript, call addEventListener() on the DOM object.
● The addEventListener() function takes three parameters:
○ event type
○ function to call, and
○ Boolean that specifies
■ true - capturing phase
■ false - bubbling phase.
Syntax:
addEventListener(“event”, Function, usecapture);
removeEventListener(“event”, function, usecapture);
Example:
window.addEventListener( "load", startTimer, false );
window.removeEventListener( "load", startTimer, false );
171. Mouse events:
mousemove - The event occurs when the pointer is moving while it is over an
element
mouseover - The event occurs when the pointer is moved onto an element
mouseout - The event occurs when a user moves the mouse pointer out of an
element
172. Example(mousemove and mouseout)
<html>
<head>
<title> mouse events </title>
</head>
<body>
<h1 id="move">My college and My department </h1>
<script>
document.getElementById("move").addEventListener("mousemove",moveone,false);
document.getElementById("move").addEventListener("mouseout",leaveone,false);
function moveone()
{
document.getElementById("move").innerHTML="kongu Engineering college";
}
function leaveone()
{
document.getElementById("move").innerHTML="Computer Technology";
}
</script></body></html>
173. Applying Event Handlers in jQuery
● In the past, jQuery has had a couple of ways to add and remove event handlers,
including bind()/unbind() and delegate()/undelegate().
● bind()-Attach a handler to an event for the elements.
● delegate()-Attach a handler to one or more events for all elements that match the
selector
● unbind()-Remove a previously-attached event handler from the elements.
● undelegate()-Remove a handler from the event for all elements which match the
current selector,
● As of jQuery 1.7, these methods have all been replaced by a simple pair, on() and
174. on()
● Event handlers are attached to jQuery objects using the on() method.
● Syntax:
○ on(events [, selector] [, data], handler(eventObject))
○ on(events-map [, selector][, data])
● events—One or more space-separated event types and optional namespaces
denoted by dot syntax;
○ for example,"click", "mouseenter mouseleave", or
"keydown.myPlugin".
● events-map—A mapping object in which the string keys specify one or more
space-separated event types, and then the values specify handler functions
that will be called when the event is triggered;
○ for example, {'click':myhandler}
175. ● selector—Optional
● data—Optional
● handler(eventObject)—If you are not using an eventsmap, you will need to
specify the handler function that will be executed when the event is
triggered
off()
To remove an event handler from elements using jQuery, call the off() method on
the jQuery object.
Syntax:
off(events [, selector] [, handler(eventObject]))
off(events-map [, selector])
176. Example(on and off)
<html><head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$(document).ready(function(){
$("p").on("mouseenter", function(){
$(this).css("background-color", "pink");
});
$("p").on("mouseleave", function(){
alert("Bye! You now leave p!");
});
$("button").click(function(){
$("p").off("mouseenter mouseleave");
});
});
</script>
</head>
<body>
<p>mouse enter to change the color.</p>
<button> click </button>
</body>
</html>
177.
178. 4.Triggering Events Manually
Triggering Events in JavaScript
It involves a three-step process
● The first step is to create an event object using the
document.createEvent() method. The createEvent() method requires
that you specify the event type for the object that is being created.
● The next step is to initialize the event object with values by calling
the events’ initialization function.
● The final step is to call dispatchEvent() on the HTML object that you
want to trigger the event for.
181. Using jQuery to Trigger Events Manually
● jQuery also provides a way to trigger events while specifying the
values of the event object using the trigger() method.
● There are two different syntaxes for the trigger() method, as
listed
○ trigger(eventType [, extraParameters])
■ $(".checkbox").trigger("click");
○ trigger( eventObject)
■ $("input.bigText").trigger({'type':'keypress','charCode':1
3});
185. 6.Implementing Callbacks
● The callback mechanism is used by calling $.Callbacks(flags) to create a callbacks
object.
● The purpose of the flags attribute is to provide the capability to specify the
behavior that should occur when different callback functions are executed.
● The possible values for flags are as follows:
once—Functions added are fired only once.
memory—As new functions are added, they are fired right away with the same values
as the last time callbacks were fired.
unique—Allows the callback functions to be added only once.
stopOnFalse—Stops firing other callback functions if one of the functions fired
returns a false.
186. ● The callbacks object supports adding functions using the
add(functionName) method and removing functions using the
remove(functionName) method.
● To fire the callback list, call the fire() method. You can also disable
the list using the disable() method.
188. <script>
function myfunction() {
var mypara = document.getElementById("p1");
var result = "";
var callbacks = jQuery.Callbacks("unique stopOnFalse");
function fun1(val) {
result = result + "function 1" + "and value is " + val + "<br>";
mypara.innerHTML = result;
};
callbacks.add(fun1);
callbacks.fire("KEC");
callbacks.add(fun1);
callbacks.fire("CT-PG");
}</script></body></html>
189. Using Deferred Objects
● A deferred object is an object that contains a set of functions that can be run at a
later time.
● It can register multiple callbacks into callback queues, invoke callback queues
● syntax:
jQuery.Deferred()