Things you should know about Javascript ES5. A programming language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else
The presentation provides an introduction to the Document Object Model (DOM) and how it allows JavaScript to access and modify HTML documents. It discusses how the DOM presents an HTML document as a tree structure, and how JavaScript can then restructure the document by adding, removing, or changing elements. It also gives examples of how DOM properties and methods allow accessing and manipulating specific nodes, such as changing the background color of the document body.
The document discusses Java Database Connectivity (JDBC) which allows Java applications to connect to databases. It describes the JDBC architecture including drivers, loading drivers, connecting to databases, executing queries and updates using Statement and PreparedStatement objects, processing result sets, and handling exceptions. It also covers transactions, result set metadata, and cleaning up resources.
Objects in JavaScript can be created using object literals, the new keyword, or Object.create(). Objects are collections of properties and methods that are mutable and manipulated by reference. Arrays are objects that represent ordered collections of values of any type and are created using array literals or the Array constructor. Common array methods include concat, join, pop, push, reverse, and sort. The Math object provides common mathematical functions like pow, round, ceil, floor, random, and trigonometric functions.
The document discusses different categories of operators in JavaScript including arithmetic, comparison, string, assignment, and conditional operators. It provides examples of using each type of operator and explains their functionality, such as that arithmetic operators perform math calculations on operands, comparison operators compare values, and assignment operators update variable values. Conditional operators return one of two possible values based on whether a condition is true or false.
This document provides an overview of AJAX and jQuery. It begins by stating the objectives of the document, which are to identify the AJAX web application model, work with AJAX and jQuery, implement selectors, manipulate the DOM, implement jQuery UI widgets. It then provides information on introducing AJAX, including how it allows asynchronous updating of web pages. It describes the components that AJAX uses, including XMLHttpRequest, JavaScript, DOM, and CSS. It also provides examples of how AJAX is used in real-life scenarios and browsers that support AJAX.
This document discusses arrays in Java programming. It covers defining and creating single and multi-dimensional arrays, accessing array elements using indexes and loops, and performing operations like sorting and finding maximum/minimum values. Examples are provided for different array types like integer, string and character arrays, and operations like input/output, break/continue statements, and star patterns. Homework involves writing a program to produce a given output pattern.
The document provides an overview of working with JSON (JavaScript Object Notation). It introduces JSON, explaining its need and comparing it to XML. It describes JSON syntax rules, data types, objects, and arrays. It discusses how JSON uses JavaScript syntax and can be used in files. The document also covers JSON security concerns, using JSON with JavaScript functions, client-side frameworks, server-side frameworks, replacing XML with JSON, and parsing and AJAX with JSON and jQuery.
SQL is a language used to communicate with databases and manage data. It allows users to create, update, and retrieve data from databases. The document outlines the history of SQL and its evolution over time. It also describes key SQL concepts like data types, commands, primary keys, database normalization, and techniques for ensuring data integrity.
This document provides an overview of Java basics including:
- Java is an object-oriented programming language like C++.
- The basic unit in Java is the object, which contains both state in the form of variables and behavior in the form of methods.
- Classes define the structure and behavior of objects through methods and variables. The main method is required to execute a Java program.
Presentation on "An Introduction to ReactJS"Flipkart
The PowerPoint presentation titled "An Introduction to ReactJS" provides a beginner-friendly overview of ReactJS, a popular JavaScript library used for building user interfaces. This presentation aims to introduce ReactJS to individuals who may not have prior technical knowledge or experience with web development.
The presentation begins with a brief introduction to ReactJS, explaining that it is a JavaScript library created by Facebook for building interactive and dynamic user interfaces. It highlights ReactJS's key features, such as component-based architecture and virtual DOM.
Next, the presentation focuses on the benefits of using ReactJS. It explains that ReactJS enhances the user experience by enabling the creation of highly responsive and efficient web applications. It emphasizes React's ability to manage complex UI components and handle data updates seamlessly.
To make the concept more relatable, the presentation provides real-world examples of popular websites and applications that use ReactJS. This helps the audience understand how ReactJS is implemented in real-world scenarios and its impact on user interface development.
Furthermore, the presentation covers the basic concepts of ReactJS, such as components, props, and state. It explains that ReactJS follows a modular approach, where the UI is divided into reusable components, making it easier to manage and update the application. It also gives a high-level overview of how props and state are used to manage data flow within React components.
Throughout the presentation, visual aids such as diagrams, screenshots, and simple illustrations are used to enhance understanding and engage the audience. The focus is on simplifying complex concepts and making them accessible to non-technical individuals.
Finally, the presentation concludes by highlighting the vast community support and resources available for learning ReactJS. It encourages the audience to explore further and provides recommendations for online tutorials, documentation, and learning platforms.
Overall, the "An Introduction to ReactJS" PowerPoint presentation aims to provide a non-technical audience with a basic understanding of ReactJS, its benefits, and its relevance in modern web development.
The document discusses Java Database Connectivity (JDBC) and how it allows Java programs to connect to databases. It describes the four types of JDBC drivers, the core JDBC interfaces like Driver, Connection, and Statement, and how to use JDBC to perform CRUD operations. The key interfaces allow establishing a database connection and executing SQL statements to retrieve and manipulate data.
The document discusses Java garbage collection. It explains that Java's garbage collector automatically manages memory by freeing unreferenced objects. The garbage collector runs when memory is low to find and delete objects that cannot be reached. While garbage collection provides convenience, it has overhead as the system must pause current execution to run it which can influence user experience. The document also describes how objects are identified as garbage using tracing and reference counting collectors as well as how to explicitly make objects available for collection and finalize objects before deletion.
Java applications cannot directly communicate with a database to submit data and retrieve the results of queries.
This is because a database can interpret only SQL statements and not Java language statements.
For this reason, you need a mechanism to translate Java statements into SQL statements.
The JDBC architecture provides the mechanism for this kind of translation.
The JDBC architecture can be classified into two layers :
JDBC application layer.
JDBC driver layer.
JDBC application layer : Signifies a Java application that uses the JDBC API to interact with the JDBC drivers. A JDBC driver is software that a Java application uses to access a database. The JDBC driver manager of JDBC API connects the Java application to the driver.
JDBC driver layer : Acts as an interface between a Java applications and a database. This layer contains a driver , such as a SQL server driver or an Oracle driver , which enables connectivity to a database.
A driver sends the request of a Java application to the database. After processing the request, the database sends the response back to the driver. The driver translates and sends the response to the JDBC API. The JDBC API forwards it to the Java application.
This document provides an overview of Java Swing components. It defines Swing as a GUI toolkit built on top of AWT that provides platform-independent and lightweight components. It describes common Swing components like JButton, JTextField, JTextArea and their usage. It also compares AWT and Swing, explaining how Swing components are more powerful and support pluggable look and feel while AWT is platform-dependent. Examples are given to demonstrate creating and using Swing components like JButton, JTextField, JTextArea etc.
This ppt gives information about:
1. OOPs Theory
2. Defining a Class
3. Creating an Object
4. The $this Attribute
5. Creating Constructors
6. Creating Destructors
This document provides an overview of several new features introduced in ECMAScript 6 (ES6), including:
1. Arrow functions which provide a shorter syntax for writing function expressions and retain the lexical this value.
2. Block scoping with let which allows block-level scoping of variables replacing the need for IIFEs in ES5. const is also introduced for single-assignment constants.
3. String templates which make it easier to construct strings and allow interpolation of variables and expressions.
Constructor is a special method in Java that is used to initialize objects. It has the same name as the class and is invoked automatically when an object is created. Constructors can be used to set default values for objects. A class can have multiple constructors as long as they have different parameters. Constructors are used to provide different initial values to objects and cannot return values.
The document provides information about HTML forms and JavaScript. It includes examples of HTML form fields like text, password, checkbox, radio buttons, and submit buttons. It also discusses how JavaScript can be used to validate form data, submit forms, and perform calculations. The last part discusses AJAX and how JavaScript and XMLHttpRequest object can be used to make asynchronous calls to retrieve and display data without reloading the page.
Introduction to java beans, java beans, Core java, j2se, getting started with java beans programming, java to standard edition, beans in java, beans programming in java
Topics Covered
==============================
Overview of .NET
Overview of ASP.NET
Creating an ASP.NET Web Form
Adding Event Procedures
Validating User Input
The document discusses JSON (JavaScript Object Notation), which is a lightweight format for exchanging data between a client and server. It notes that JSON is easy for humans to read and write, and easy for machines to parse and generate. The document outlines the syntax of JSON, including that objects use curly braces, members use key-value pairs separated by commas, and arrays use square brackets. It also discusses parsing and accessing JSON data.
The document provides an overview of jQuery including:
- What jQuery is and its main features like DOM manipulation and AJAX
- How to include jQuery in an HTML document and basic usage syntax
- jQuery selectors to find elements and filters to refine selections
- Common jQuery methods for manipulating attributes, events, HTML, CSS, and more
- Examples of using various jQuery functions and concepts
There are several JavaScript libraries available in the world of web programming. And, as the usage and complexity is increasing day by day, sometimes it becomes very difficult and confusing to understand and create modules using those libraries, especially for those having strong background of Object Oriented Languages.
So this one hour session will make an effort to go into the very basics of JavaScript and put a base for writing modular JavaScript code.
The document discusses different state management techniques in ASP.NET. It describes client-side techniques like hidden fields, view state, cookies, query strings, and control state. It also describes server-side techniques like session state and application state. Session state stores and retrieves data for each user session while application state stores data accessible to all users. Examples are provided for hidden fields, view state, cookies, query strings, session state, and application state.
This document provides an introduction to jQuery, covering its features, comparisons to other frameworks, selectors, and plugins. jQuery is an open-source JavaScript library that simplifies DOM manipulation, event handling, animations, and Ajax interactions. It uses CSS-style selectors to select and manipulate HTML elements. Some key features include DOM element selections, DOM traversal/modification, DOM manipulation based on CSS selectors, events, effects/animations, Ajax, and extensibility through plugins. The document also discusses jQuery versus other frameworks like Dojo and YUI, demonstrates basic selectors and methods, and encourages the use of plugins to add additional functionality.
JavaScript is a scripting language originally designed for web browsers but now used everywhere. It has dynamic typing and supports object-oriented, imperative, and functional programming. JavaScript was created in 1995 and standardized in 1999. It is now the most popular language on GitHub. JavaScript can be used to build interactive web pages, desktop applications, server-side applications, IoT applications, and real-time applications. The core data types in JavaScript are Number, String, Boolean, Object, Function, Array, Date, and Regular Expressions. JavaScript supports features like variables, flow control, error handling, debugging, and JSON for data exchange.
The document discusses HTML5 semantic elements and how they can be used to structure web pages in a more transparent way compared to traditional <div> elements. It provides examples of common HTML5 semantic elements like <header>, <nav>, <article>, <section>, and <aside> that can be used instead of <div> for specific sections like navigation, headers, articles, etc. The document also briefly reviews common HTML4 elements like <html>, <head>, <title>, <body>, and heading elements to provide context before discussing the new HTML5 semantic elements.
Intro to JavaScript - Week 4: Object and ArrayJeongbae Oh
Intro to Programming with JavaScript Seminar, Fall 2017 semester
Week 4: Object and Array
Led by Jeongbae Oh, in conjunction with YCC (Yonsei Computer Club) @ Yonsei University
This seminar intends to introduce newcomers to programming using JavaScript, one of the most versatile languages of the modern world.
The document provides an overview of working with JSON (JavaScript Object Notation). It introduces JSON, explaining its need and comparing it to XML. It describes JSON syntax rules, data types, objects, and arrays. It discusses how JSON uses JavaScript syntax and can be used in files. The document also covers JSON security concerns, using JSON with JavaScript functions, client-side frameworks, server-side frameworks, replacing XML with JSON, and parsing and AJAX with JSON and jQuery.
SQL is a language used to communicate with databases and manage data. It allows users to create, update, and retrieve data from databases. The document outlines the history of SQL and its evolution over time. It also describes key SQL concepts like data types, commands, primary keys, database normalization, and techniques for ensuring data integrity.
This document provides an overview of Java basics including:
- Java is an object-oriented programming language like C++.
- The basic unit in Java is the object, which contains both state in the form of variables and behavior in the form of methods.
- Classes define the structure and behavior of objects through methods and variables. The main method is required to execute a Java program.
Presentation on "An Introduction to ReactJS"Flipkart
The PowerPoint presentation titled "An Introduction to ReactJS" provides a beginner-friendly overview of ReactJS, a popular JavaScript library used for building user interfaces. This presentation aims to introduce ReactJS to individuals who may not have prior technical knowledge or experience with web development.
The presentation begins with a brief introduction to ReactJS, explaining that it is a JavaScript library created by Facebook for building interactive and dynamic user interfaces. It highlights ReactJS's key features, such as component-based architecture and virtual DOM.
Next, the presentation focuses on the benefits of using ReactJS. It explains that ReactJS enhances the user experience by enabling the creation of highly responsive and efficient web applications. It emphasizes React's ability to manage complex UI components and handle data updates seamlessly.
To make the concept more relatable, the presentation provides real-world examples of popular websites and applications that use ReactJS. This helps the audience understand how ReactJS is implemented in real-world scenarios and its impact on user interface development.
Furthermore, the presentation covers the basic concepts of ReactJS, such as components, props, and state. It explains that ReactJS follows a modular approach, where the UI is divided into reusable components, making it easier to manage and update the application. It also gives a high-level overview of how props and state are used to manage data flow within React components.
Throughout the presentation, visual aids such as diagrams, screenshots, and simple illustrations are used to enhance understanding and engage the audience. The focus is on simplifying complex concepts and making them accessible to non-technical individuals.
Finally, the presentation concludes by highlighting the vast community support and resources available for learning ReactJS. It encourages the audience to explore further and provides recommendations for online tutorials, documentation, and learning platforms.
Overall, the "An Introduction to ReactJS" PowerPoint presentation aims to provide a non-technical audience with a basic understanding of ReactJS, its benefits, and its relevance in modern web development.
The document discusses Java Database Connectivity (JDBC) and how it allows Java programs to connect to databases. It describes the four types of JDBC drivers, the core JDBC interfaces like Driver, Connection, and Statement, and how to use JDBC to perform CRUD operations. The key interfaces allow establishing a database connection and executing SQL statements to retrieve and manipulate data.
The document discusses Java garbage collection. It explains that Java's garbage collector automatically manages memory by freeing unreferenced objects. The garbage collector runs when memory is low to find and delete objects that cannot be reached. While garbage collection provides convenience, it has overhead as the system must pause current execution to run it which can influence user experience. The document also describes how objects are identified as garbage using tracing and reference counting collectors as well as how to explicitly make objects available for collection and finalize objects before deletion.
Java applications cannot directly communicate with a database to submit data and retrieve the results of queries.
This is because a database can interpret only SQL statements and not Java language statements.
For this reason, you need a mechanism to translate Java statements into SQL statements.
The JDBC architecture provides the mechanism for this kind of translation.
The JDBC architecture can be classified into two layers :
JDBC application layer.
JDBC driver layer.
JDBC application layer : Signifies a Java application that uses the JDBC API to interact with the JDBC drivers. A JDBC driver is software that a Java application uses to access a database. The JDBC driver manager of JDBC API connects the Java application to the driver.
JDBC driver layer : Acts as an interface between a Java applications and a database. This layer contains a driver , such as a SQL server driver or an Oracle driver , which enables connectivity to a database.
A driver sends the request of a Java application to the database. After processing the request, the database sends the response back to the driver. The driver translates and sends the response to the JDBC API. The JDBC API forwards it to the Java application.
This document provides an overview of Java Swing components. It defines Swing as a GUI toolkit built on top of AWT that provides platform-independent and lightweight components. It describes common Swing components like JButton, JTextField, JTextArea and their usage. It also compares AWT and Swing, explaining how Swing components are more powerful and support pluggable look and feel while AWT is platform-dependent. Examples are given to demonstrate creating and using Swing components like JButton, JTextField, JTextArea etc.
This ppt gives information about:
1. OOPs Theory
2. Defining a Class
3. Creating an Object
4. The $this Attribute
5. Creating Constructors
6. Creating Destructors
This document provides an overview of several new features introduced in ECMAScript 6 (ES6), including:
1. Arrow functions which provide a shorter syntax for writing function expressions and retain the lexical this value.
2. Block scoping with let which allows block-level scoping of variables replacing the need for IIFEs in ES5. const is also introduced for single-assignment constants.
3. String templates which make it easier to construct strings and allow interpolation of variables and expressions.
Constructor is a special method in Java that is used to initialize objects. It has the same name as the class and is invoked automatically when an object is created. Constructors can be used to set default values for objects. A class can have multiple constructors as long as they have different parameters. Constructors are used to provide different initial values to objects and cannot return values.
The document provides information about HTML forms and JavaScript. It includes examples of HTML form fields like text, password, checkbox, radio buttons, and submit buttons. It also discusses how JavaScript can be used to validate form data, submit forms, and perform calculations. The last part discusses AJAX and how JavaScript and XMLHttpRequest object can be used to make asynchronous calls to retrieve and display data without reloading the page.
Introduction to java beans, java beans, Core java, j2se, getting started with java beans programming, java to standard edition, beans in java, beans programming in java
Topics Covered
==============================
Overview of .NET
Overview of ASP.NET
Creating an ASP.NET Web Form
Adding Event Procedures
Validating User Input
The document discusses JSON (JavaScript Object Notation), which is a lightweight format for exchanging data between a client and server. It notes that JSON is easy for humans to read and write, and easy for machines to parse and generate. The document outlines the syntax of JSON, including that objects use curly braces, members use key-value pairs separated by commas, and arrays use square brackets. It also discusses parsing and accessing JSON data.
The document provides an overview of jQuery including:
- What jQuery is and its main features like DOM manipulation and AJAX
- How to include jQuery in an HTML document and basic usage syntax
- jQuery selectors to find elements and filters to refine selections
- Common jQuery methods for manipulating attributes, events, HTML, CSS, and more
- Examples of using various jQuery functions and concepts
There are several JavaScript libraries available in the world of web programming. And, as the usage and complexity is increasing day by day, sometimes it becomes very difficult and confusing to understand and create modules using those libraries, especially for those having strong background of Object Oriented Languages.
So this one hour session will make an effort to go into the very basics of JavaScript and put a base for writing modular JavaScript code.
The document discusses different state management techniques in ASP.NET. It describes client-side techniques like hidden fields, view state, cookies, query strings, and control state. It also describes server-side techniques like session state and application state. Session state stores and retrieves data for each user session while application state stores data accessible to all users. Examples are provided for hidden fields, view state, cookies, query strings, session state, and application state.
This document provides an introduction to jQuery, covering its features, comparisons to other frameworks, selectors, and plugins. jQuery is an open-source JavaScript library that simplifies DOM manipulation, event handling, animations, and Ajax interactions. It uses CSS-style selectors to select and manipulate HTML elements. Some key features include DOM element selections, DOM traversal/modification, DOM manipulation based on CSS selectors, events, effects/animations, Ajax, and extensibility through plugins. The document also discusses jQuery versus other frameworks like Dojo and YUI, demonstrates basic selectors and methods, and encourages the use of plugins to add additional functionality.
JavaScript is a scripting language originally designed for web browsers but now used everywhere. It has dynamic typing and supports object-oriented, imperative, and functional programming. JavaScript was created in 1995 and standardized in 1999. It is now the most popular language on GitHub. JavaScript can be used to build interactive web pages, desktop applications, server-side applications, IoT applications, and real-time applications. The core data types in JavaScript are Number, String, Boolean, Object, Function, Array, Date, and Regular Expressions. JavaScript supports features like variables, flow control, error handling, debugging, and JSON for data exchange.
The document discusses HTML5 semantic elements and how they can be used to structure web pages in a more transparent way compared to traditional <div> elements. It provides examples of common HTML5 semantic elements like <header>, <nav>, <article>, <section>, and <aside> that can be used instead of <div> for specific sections like navigation, headers, articles, etc. The document also briefly reviews common HTML4 elements like <html>, <head>, <title>, <body>, and heading elements to provide context before discussing the new HTML5 semantic elements.
Intro to JavaScript - Week 4: Object and ArrayJeongbae Oh
Intro to Programming with JavaScript Seminar, Fall 2017 semester
Week 4: Object and Array
Led by Jeongbae Oh, in conjunction with YCC (Yonsei Computer Club) @ Yonsei University
This seminar intends to introduce newcomers to programming using JavaScript, one of the most versatile languages of the modern world.
The document discusses various techniques for developing plugins for the Leaflet.js mapping library, including adding new methods, overriding existing methods, and creating new objects by extending existing ones. It provides examples of adding animated spiders to a Leaflet map using these different customization approaches. The full source code for the leaflet-spiders plugin demonstrated is available on GitHub.
This document provides a review of object-oriented programming concepts in Java, including:
- The difference between primitives and objects, and value vs reference semantics.
- How classes act as blueprints for objects, defining their data and behavior.
- Key object-oriented principles like encapsulation, fields, methods, and constructors.
- How objects pass by reference when used as parameters or assigned.
- Comparing objects requires special methods rather than using ==.
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 discusses Domain Driven Design (DDD) value objects. It defines value objects as immutable objects that measure or describe a concept but have no identity. Their equality is based on attribute values rather than identity. The document outlines characteristics of value objects such as being immutable, having attributes that form a conceptual whole, being replaceable, supporting equality comparisons, and having side-effect-free methods. It provides examples of value objects and discusses standard types, storage, testing, implementations, and resources for further information on DDD value objects.
This document discusses Elasticsearch and provides examples of its real-world uses and basic functionality. It contains:
1) An overview of Elasticsearch and how it can be used for full-text search, analytics, and structured querying of large datasets. Dell and The Guardian are discussed as real-world use cases.
2) Explanations of basic Elasticsearch concepts like indexes, types, mappings, and inverted indexes. Examples of indexing, updating, and deleting documents.
3) Details on searching and filtering documents through queries, filters, aggregations, and aliases. Query DSL and examples of common queries like term, match, range are provided.
4) A discussion of potential data modeling designs for indexing user
- JavaScript is a client-side scripting language used to validate data and embed scripts in HTML documents using the <SCRIPT> tag. It was developed by Brendan Eich and is supported by most browsers.
- Functions, variables, operators, and control structures work similarly in JavaScript as in C++. Common data types include numbers, strings, and Booleans. Functions are defined using the function keyword.
- Built-in functions like alert(), prompt(), and document.write() are used for output. Events like onclick trigger JavaScript execution. Arrays and objects allow storing multiple values.
The document discusses functions and objects in JavaScript. It defines a function as a reusable block of code that performs operations to fulfill a specific task. Functions can be invoked to execute their code. Objects are collections of properties and methods that represent real-world entities. The document describes how to create user-defined functions and objects in JavaScript, including defining properties and methods. It also provides examples of the built-in String and Math objects and their properties and methods.
This course teaches you the concepts of Angular. You will learn how to utilize Components, Annotations, Views, Event Handlers, Directives and more. In Angular everything is a Component and this course takes a component-centric approach. We will use Components as the main point of discussion and you will learn about other concepts in Angular in the context of Components.
This document provides information about an upcoming DataWeave meetup session, including details about the speaker, agenda, and logistics. The speaker will discuss DataWeave basics like data types, operators, and expressions for transforming data to JSON, Java, and XML formats. The session will include hands-on examples using the Transform Message component. Attendees can ask questions in the chat and provide feedback after the meetup.
The document provides an overview of JavaScript objects, functions, and data types. It discusses that JavaScript objects can contain properties and almost everything in JavaScript is an object. Functions are blocks of reusable code that perform tasks when invoked. JavaScript supports primitive data types like strings, numbers, Booleans as well as complex types like objects, arrays. It provides examples and explanations of how to work with each of these concepts in JavaScript.
advance level of javascript fundamentals has been covered in these slide try it out learn with an ease. https://auroskkil.com/
It contains basic fundamental of class, object, method overloading, constructor, destructor, visibility, acess specifier, Methods, overloading, clonning of objects etc. are covered here.
Kindly look at it and give your comments to improve it as good as possible ways.
This document discusses object oriented PHP concepts including classes, inheritance, overriding functions, error handling, and file uploads. It provides examples of creating a class with methods, instantiating objects, extending classes, overriding parent methods, and defining custom error handling functions. It also demonstrates how to upload files in PHP by handling the file on the server, checking for errors, and moving the file to a target directory.
The document discusses the history and features of HTML5. It began development in 2008 by the W3C and WHATWG to address key challenges for developers. HTML5 adds new elements, attributes, and APIs to support graphics, location data, storage, and improved JavaScript performance. It also defines tags for embedding video, audio, and other media. While still a work in progress, major browsers now support many HTML5 features.
This presentation talks about managing a session and cookies in web using PHP. Cookies are stored at client machine and sent back to the server after first consecutive requests.Session manages the user state on the web page for security purpose as well.
MySQL is a free, open-source relational database management system that is ideal for both small and large applications. PHP can connect to and interact with a MySQL database using extensions like MySQLi or PDO. The document provides code examples for connecting to a MySQL database, executing queries to retrieve, insert, update, and delete data, and other common MySQL operations when using PHP.
PHP arrays allow storing multiple values in a single variable. There are several types of arrays including numeric, associative, multidimensional, and mixed. Arrays can be created using the array() function or by directly assigning values with indexes. Array elements can be accessed using their index/key and printed. Common array functions include array_merge() to join arrays, array_push() to add elements, and sort functions like sort(), asort(), ksort() to sort arrays.
The document provides information about PHP (Hypertext Preprocessor) including what a server is, different types of servers, basic PHP syntax, variables, operators, conditional statements, loops, functions, and arrays. It defines PHP as a scripting language used for web development and describes its major components. Examples are given of variables, constants, arithmetic operators, and if/else conditional statements in PHP code.
This document provides an introduction to regular expressions (regexes). It explains that regexes describe patterns of text that can be used to search for and replace text. It covers basic regex syntax like literals, wildcards, anchors, quantifiers, character sets, flags, backreferences, and the RegExp object. It also discusses using regexes in JavaScript string methods, text editors, and command line tools.
The document provides an introduction to JavaScript, including its history and uses. It discusses how JavaScript is an interpreted programming language used for client-side scripting of web pages to make them dynamic and interactive. The document outlines key JavaScript concepts like variables, functions, operators, and conditional statements. It provides examples of how to write JavaScript programs and embed them in HTML files using the <script> tag.
CSS is used to style and lay out web pages. It allows separation of document content from page layout and design. CSS rules contain selectors that specify the elements to style and properties that define the styles. Common properties include font, color, background, borders, margin and padding. CSS rules can be defined internally, in a linked stylesheet, or inline in HTML elements. CSS provides control over text, font, color, spacing and layout to present content attractively and consistently across multiple browsers and devices.
The document provides an overview of the key technologies that enable the World Wide Web. It discusses how the Web is a subset of the Internet that uses HTTP to access interlinked hypertext documents from servers. The TCP/IP protocol handles communication between networks, while technologies like HTML, URLs, domain names, browsers and servers allow people and computers to access and share information over the Internet through the World Wide Web. The document also reviews some common uses of the Internet and factors to consider when selecting technologies for websites.
RMI allows Java objects to invoke methods on remote Java objects located in another Java Virtual Machine. It handles marshaling parameters, transportation between client and server, and unmarshaling results. To create an RMI application, interfaces define remote services, servers implement interfaces and register with the RMI registry, and clients lookup services and invoke remote methods similarly to local calls. Stub and skeleton objects handle communication between remote VMs.
It is presentation of Kotlin programming language created by JetBrains for android application developement. Here we also provided some resources on Kotlin. Jump start your learning about kotlin.
The document discusses various security issues related to sessions and form handling in PHP, as well as methods for preventing attacks. It covers session fixation, session hijacking, and form spoofing. For sessions, it recommends regenerating IDs, checking IP addresses and user agents, and using secure hashes. For forms, it suggests using a shared secret key stored in the session to validate form submissions. The document also discusses PHP filters for validating and sanitizing user input.
How to Manage Purchase Alternatives in Odoo 18Celine George
Managing purchase alternatives is crucial for ensuring a smooth and cost-effective procurement process. Odoo 18 provides robust tools to handle alternative vendors and products, enabling businesses to maintain flexibility and mitigate supply chain disruptions.
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetSritoma Majumder
Introduction
All the materials around us are made up of elements. These elements can be broadly divided into two major groups:
Metals
Non-Metals
Each group has its own unique physical and chemical properties. Let's understand them one by one.
Physical Properties
1. Appearance
Metals: Shiny (lustrous). Example: gold, silver, copper.
Non-metals: Dull appearance (except iodine, which is shiny).
2. Hardness
Metals: Generally hard. Example: iron.
Non-metals: Usually soft (except diamond, a form of carbon, which is very hard).
3. State
Metals: Mostly solids at room temperature (except mercury, which is a liquid).
Non-metals: Can be solids, liquids, or gases. Example: oxygen (gas), bromine (liquid), sulphur (solid).
4. Malleability
Metals: Can be hammered into thin sheets (malleable).
Non-metals: Not malleable. They break when hammered (brittle).
5. Ductility
Metals: Can be drawn into wires (ductile).
Non-metals: Not ductile.
6. Conductivity
Metals: Good conductors of heat and electricity.
Non-metals: Poor conductors (except graphite, which is a good conductor).
7. Sonorous Nature
Metals: Produce a ringing sound when struck.
Non-metals: Do not produce sound.
Chemical Properties
1. Reaction with Oxygen
Metals react with oxygen to form metal oxides.
These metal oxides are usually basic.
Non-metals react with oxygen to form non-metallic oxides.
These oxides are usually acidic.
2. Reaction with Water
Metals:
Some react vigorously (e.g., sodium).
Some react slowly (e.g., iron).
Some do not react at all (e.g., gold, silver).
Non-metals: Generally do not react with water.
3. Reaction with Acids
Metals react with acids to produce salt and hydrogen gas.
Non-metals: Do not react with acids.
4. Reaction with Bases
Some non-metals react with bases to form salts, but this is rare.
Metals generally do not react with bases directly (except amphoteric metals like aluminum and zinc).
Displacement Reaction
More reactive metals can displace less reactive metals from their salt solutions.
Uses of Metals
Iron: Making machines, tools, and buildings.
Aluminum: Used in aircraft, utensils.
Copper: Electrical wires.
Gold and Silver: Jewelry.
Zinc: Coating iron to prevent rusting (galvanization).
Uses of Non-Metals
Oxygen: Breathing.
Nitrogen: Fertilizers.
Chlorine: Water purification.
Carbon: Fuel (coal), steel-making (coke).
Iodine: Medicines.
Alloys
An alloy is a mixture of metals or a metal with a non-metal.
Alloys have improved properties like strength, resistance to rusting.
Title: A Quick and Illustrated Guide to APA Style Referencing (7th Edition)
This visual and beginner-friendly guide simplifies the APA referencing style (7th edition) for academic writing. Designed especially for commerce students and research beginners, it includes:
✅ Real examples from original research papers
✅ Color-coded diagrams for clarity
✅ Key rules for in-text citation and reference list formatting
✅ Free citation tools like Mendeley & Zotero explained
Whether you're writing a college assignment, dissertation, or academic article, this guide will help you cite your sources correctly, confidently, and consistent.
Created by: Prof. Ishika Ghosh,
Faculty.
📩 For queries or feedback: [email protected]
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingCeline George
The Accounting module in Odoo 17 is a complete tool designed to manage all financial aspects of a business. Odoo offers a comprehensive set of tools for generating financial and tax reports, which are crucial for managing a company's finances and ensuring compliance with tax regulations.
The Pala kings were people-protectors. In fact, Gopal was elected to the throne only to end Matsya Nyaya. Bhagalpur Abhiledh states that Dharmapala imposed only fair taxes on the people. Rampala abolished the unjust taxes imposed by Bhima. The Pala rulers were lovers of learning. Vikramshila University was established by Dharmapala. He opened 50 other learning centers. A famous Buddhist scholar named Haribhadra was to be present in his court. Devpala appointed another Buddhist scholar named Veerdeva as the vice president of Nalanda Vihar. Among other scholars of this period, Sandhyakar Nandi, Chakrapani Dutta and Vajradatta are especially famous. Sandhyakar Nandi wrote the famous poem of this period 'Ramcharit'.
Geography Sem II Unit 1C Correlation of Geography with other school subjectsProfDrShaikhImran
The correlation of school subjects refers to the interconnectedness and mutual reinforcement between different academic disciplines. This concept highlights how knowledge and skills in one subject can support, enhance, or overlap with learning in another. Recognizing these correlations helps in creating a more holistic and meaningful educational experience.
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsesushreesangita003
what is pulse ?
Purpose
physiology and Regulation of pulse
Characteristics of pulse
factors affecting pulse
Sites of pulse
Alteration of pulse
for BSC Nursing 1st semester
for Gnm Nursing 1st year
Students .
vitalsign
Link your Lead Opportunities into Spreadsheet using odoo CRMCeline George
In Odoo 17 CRM, linking leads and opportunities to a spreadsheet can be done by exporting data or using Odoo’s built-in spreadsheet integration. To export, navigate to the CRM app, filter and select the relevant records, and then export the data in formats like CSV or XLSX, which can be opened in external spreadsheet tools such as Excel or Google Sheets.
APM event hosted by the Midlands Network on 30 April 2025.
Speaker: Sacha Hind, Senior Programme Manager, Network Rail
With fierce competition in today’s job market, candidates need a lot more than a good CV and interview skills to stand out from the crowd.
Based on her own experience of progressing to a senior project role and leading a team of 35 project professionals, Sacha shared not just how to land that dream role, but how to be successful in it and most importantly, how to enjoy it!
Sacha included her top tips for aspiring leaders – the things you really need to know but people rarely tell you!
We also celebrated our Midlands Regional Network Awards 2025, and presenting the award for Midlands Student of the Year 2025.
This session provided the opportunity for personal reflection on areas attendees are currently focussing on in order to be successful versus what really makes a difference.
Sacha answered some common questions about what it takes to thrive at a senior level in a fast-paced project environment: Do I need a degree? How do I balance work with family and life outside of work? How do I get leadership experience before I become a line manager?
The session was full of practical takeaways and the audience also had the opportunity to get their questions answered on the evening with a live Q&A session.
Attendees hopefully came away feeling more confident, motivated and empowered to progress their careers
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 795 from Texas, New Mexico, Oklahoma, and Kansas. 95 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...larencebapu132
This is short and accurate description of World war-1 (1914-18)
It can give you the perfect factual conceptual clarity on the great war
Regards Simanchala Sarab
Student of BABed(ITEP, Secondary stage)in History at Guru Nanak Dev University Amritsar Punjab 🙏🙏
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
2. • Objects are composed of attributes. If an attribute contains a function, it is considered
to be a method of the object otherwise, the attribute is considered a property.
• Object Properties:
– Object properties can be any of the three primitive data types, or any of the abstract data
types, such as another object.
– objectName.objectProperty = propertyValue;
– var str = document.title;
• Object Methods:
– The methods are functions that let the object do something or let something be done to it.
There is little difference between a function and a method, except that a function is a
standalone unit of statements and a method is attached to an object and can be referenced
by the this keyword
– Following is a simple example to show how to use write() method of document object to
write any content on the document:
– document.write("This is test");
• The new Operator:
– The new operator is used to create an instance of an object. To create an object, the new
operator is followed by the constructor method.
– var books = new Array("C++", "Perl", "Java");
– var day = new Date("August 15, 1947");
11-Apr-19 2
3. • Example:
point = new Object();
point.x=17;
point.y=22;
alert(point.x+' : '+point.y)
// Would alert: 17 : 22
• Example:
<script type="text/javascript">
var book = new Object(); // Create the object
book.subject = "Perl"; // Assign properties to the object
book.author = "Mohit";
</script>
</head>
<body>
<script type="text/javascript">
document.write("Book name is : " + book.subject + "<br>");
document.write("Book author is : " + book.author + "<br>");
</script>
// would print Book name is: perl
Book author: Mohit
11-Apr-19 3
4. • Example:
This example demonstrates how to create an object with a User-Defined Function. Here this
keyword is used to refer to the object that has been passed to a function:
<script type="text/javascript">
function book(title, author){
this.title = title;
this.author = author;
}
</script>
</head>
<body>
<script type="text/javascript">
var myBook = new book("Perl", “abcd");
document.write("Book title is : " + myBook.title + "<br>");
document.write("Book author is : " + myBook.author + "<br>");
</script>
11-Apr-19 4
5. • Example:
Here is a simple example to show how to add a function along with an object:
<script type="text/javascript"> // Define a function which will work as a method
function addPrice(amount){
this.price = amount;
}
function book(title, author){
this.title = title;
this.author = author;
this.addPrice = addPrice; // Assign that method as property.
}
</script>
</head>
<body> <script type="text/javascript">
var myBook = new book("Perl", "Mohtashim");
myBook.addPrice(100);
document.write("Book title is : " + myBook.title + "<br>");
document.write("Book author is : " + myBook.author + "<br>");
document.write("Book price is : " + myBook.price + "<br>");
</script>
11-Apr-19 5
6. • Example:
Here is a simple example to show how to add a function along with an object:
<script type="text/javascript"> // Define a function which will work as a method
function addPrice(amount){
this.price = amount;
}
function book(title, author){
this.title = title;
this.author = author;
this.addPrice = addPrice; // Assign that method as property.
}
</script>
</head>
<body> <script type="text/javascript">
var myBook = new book("Perl", "Mohtashim");
myBook.addPrice(100);
document.write("Book title is : " + myBook.title + "<br>");
document.write("Book author is : " + myBook.author + "<br>");
document.write("Book price is : " + myBook.price + "<br>");
</script>
11-Apr-19 6
8. • JavaScript has only one type of number.
• Numbers can be written with, or without decimals.
• All JavaScript Numbers are 64-bit
• The Number object represents numerical date, either integers or floating-point numbers.
• var val = new Number(number);
• Number Properties:
11-Apr-19 8
9. • Number Properties:
function showValue()
{
var smallNumber = (-Number.MAX_VALUE) * 2
if (smallNumber == Number.NEGATIVE_INFINITY) {
alert("Value of smallNumber : " + smallNumber ); }
}
Value of val : -Infinity
function showValue()
{
var bigNumber = Number.MAX_VALUE * 2
if (bigNumber == Number.POSITIVE_INFINITY) {
alert("Value of bigNumber : " + bigNumber ); }
}
Value of val : Infinity
11-Apr-19 9
10. • Number Properties:
function showValue() {
var val = Number.MAX_VALUE;
alert("Value of Number.MAX_VALUE : " + val );
}
Value of Number.MAX_VALUE : 1.7976931348623157 x 10308
function showValue() {
var val = Number.MIN_VALUE;
alert("Value of Number.MIN_VALUE : " + val );
}
Value of Number.MIN_VALUE : 5 x 10-324
11-Apr-19 10
11. • Number Properties:
function showValue() {
var dayOfMonth = 50;
if (dayOfMonth < 1 || dayOfMonth > 31)
{
dayOfMonth = Number.NaN
alert("Day of Month must be between 1 and 31.")
}
alert("Value of dayOfMonth : " + dayOfMonth );
}
Day of Month must be between 1 and 31. Value of dayOfMonth : NaN
11-Apr-19 11
12. • Example
// The following example creates a Number object, myNum,
// then adds a description property to all Number objects.
// Then a value is assigned to the myNum object's description property.
myNum = new Number(65);
Number.prototype.description=null;
myNum.description="wind speed"
alert('The '+myNum.description+' is: '+myNum);
// Would alert: The wind speed is 65
11-Apr-19 12
14. Example:
<script type="text/javascript">
var num=77.1234;
var val = num.toExponential();
document.write("num.toExponential() is : " + val );
document.write("<br />");
val = num.toExponential(4);
document.write("num.toExponential(4) is : " + val );
document.write("<br />");
val = num.toExponential(2);
document.write("num.toExponential(2) is : " + val);
document.write("<br />");
val = 77.1234.toExponential();
document.write("77.1234.toExponential()is : " + val );
document.write("<br />");
val = 77.1234.toExponential();
document.write("77 .toExponential() is : " + val);
</script>
num.toExponential() is : 7.71234e+1
num.toExponential(4) is : 7.7123e+1
num.toExponential(2) is : 7.71e+1
77.1234.toExponential()is:7.71234e+1
77 .toExponential() is : 7.71234e+1
11-Apr-19 14
16. • The Date object is a datatype built into the JavaScript language. Date objects are created with the
new Date( )
• Once a Date object is created, a number of methods allow you to operate on it. Most methods
simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields
• Syntax 1
var myDate = new Date()
Syntax 2
var myDate = new Date([parameters])
Syntax 3
var myDate = new Date(dateString)
Syntax 4
var myDate = new Date("month dd, yyyy")
Syntax 5
var myDate = new Date("month dd, yyyy hh:mm:ss")
Syntax 6
var myDate = new Date(yy, mm, dd)
Syntax 7
var myDate = new Date(yy, mm, dd, hh, mm, ss)
Syntax 8
var myDate = new Date("miliseconds")
11-Apr-19 16
17. • Example 1 :
var myDate=new Date();
alert('Right now it is: '+myDate.toLocaleString());
Example 2 :
myDate = new Date("October 13, 1966 13:35:00");
weekdays=new Array('Sun','Mon','Tues','Wednes','Thurs','Fri','Satur');
alert('I was born a '+weekdays[myDate.getDay()]+'day.');
Example 3 :
// Note: October is month number 9! (Cause January is 0)
// The reason for this is that it fits well for Arrays,
// cause first item in an Array is item number zero.
// Look at this example:
myDate = new Date(1966,9,13);
months=new Array('Jan','Feb','Mar','Apr','May','June',
'July','Aug','Sep','Oct','Nov','Dec');
alert('I was born in '+months[myDate.getMonth()]);
11-Apr-19 17
18. • Example 4 :
myDate = new Date(1966,9,13,13,35,0);
nowDate = new Date();
milliseconds=nowDate.getTime()-myDate.getTime();
days=Math.floor(milliseconds/(1000*60*60*24));
alert('I have lived for '+days+' days.');
Example 5 :
myDate = new Date(1966,9,13,13,35,0);
nowDate = new Date();
milliseconds=nowDate.getTime()-myDate.getTime();
hours=Math.floor(milliseconds/(1000*60*60));
alert('I have lived for '+hours+' hours.');
Example 6 :
nowDate = new Date();
xmasDate = new Date(nowDate.getYear(),11,24);
milliseconds=xmasDate.getTime()-nowDate.getTime();
days=Math.floor(milliseconds/(1000*60*60*24));
alert('There are '+days+' days left till christmas eve.');
11-Apr-19 18
20. • The math object provides you properties and methods for mathematical constants and functions.
• Unlike the other global objects, Math is not a constructor. All properties and methods of Math are
static and can be called by using Math as an object without creating it.
• Syntax 1
Math.property(value)
Syntax 2
Math.method(value)
• Properties:
E Euler's constant and the base of natural logarithms, approximately 2.718.
LN2 Natural logarithm of 2, approximately 0.693.
LN10 Natural logarithm of 10, approximately 2.302.
LOG2E Base 2 logarithm of E, approximately 1.442.
LOG10E Base 10 logarithm of E, approximately 0.434.
PI Ratio of the circumference of a circle to its diameter, approximately 3.14159.
SQRT1_2 Square root of 1/2; equivalently, 1 over the square root of 2, approximately
0.707.
SQRT2 Square root of 2, approximately 1.414.
11-Apr-19 20
21. • Properties Example:
var property_value = Math.LN2 (0.693)
var property_value = Math.E (Euler’s Constant – 2.718)
var property_value = Math.LN10 (2.302)
var property_value = Math.LOG2E (1.442)
var property_value = Math.LOG10E (0.434)
var property_value = Math.PI (3.141)
11-Apr-19 21
22. • Methods:
abs() Returns the absolute value of a number.
acos() Returns the arccosine (in radians) of a number.
asin() Returns the arcsine (in radians) of a number.
atan() Returns the arctangent (in radians) of a number.
atan2() Returns the arctangent of the quotient of its arguments.
ceil() Returns the smallest integer greater than or equal to a number.
cos() Returns the cosine of a number.
exp() Returns EN, where N is the argument, and E is Euler's constant, the base of the natural
logarithm.
floor() Returns the largest integer less than or equal to a number.
log() Returns the natural logarithm (base E) of a number.
max() Returns the largest of zero or more numbers.
min() Returns the smallest of zero or more numbers.
pow() Returns base to the exponent power, that is, base exponent.
random() Returns a pseudo-random number between 0 and 1.
round() Returns the value of a number rounded to the nearest integer.
sin() Returns the sine of a number.
sqrt() Returns the square root of a number.
tan() Returns the tangent of a number.
11-Apr-19 22
23. • Methods Example:
var value = Math.abs(-1); (1)
var value = Math.abs(null); (0)
var value = Math.abs(20); (20)
var value = Math.abs("string"); (NaN)
var value = Math.ceil(45.95); (46)
var value = Math.ceil(45.20); (46)
var value = Math.ceil(-45.95); (-45)
var value = Math.ceil(-45.20); (-45)
var value = Math.max(10, 20, -1, 100); (100)
var value = Math.max(-1, -3, -40); (-1)
var value = Math.max(0, -1); (0)
var value = Math.max(100); (100)
11-Apr-19 23
25. • What is RegExp?
When you search in a text, you can use a pattern to describe what you are searching for.
A simple pattern can be one single character.
Regular expressions are very powerful tools for performing pattern matches.
You can perform complex tasks that once required lengthy procedures with just a few lines of
code using regular expressions
A more complicated pattern can consist of more characters, and can be used for parsing, format
checking, substitution and more.
Regular expressions are used to perform powerful pattern-matching and "search-and-replace"
functions on text.
A regular expression is an object that describes a pattern of characters.
11-Apr-19 25
26. • Syntax:
var pattern = new RegExp(pattern, attributes);
or simply
var pattern = /pattern/attributes(modifiers);
• pattern: A string that specifies the pattern of the regular expression or another regular expression.
• attributes: An optional string containing any of the "g", "i", and "m" attributes that specify global,
case-insensitive, and multiline matches, respectively.
• Modifiers are used to perform case-insensitive and global searches.
• The i modifier is used to perform case-insensitive matching.
• The g modifier is used to perform a global match (find all matches rather than stopping after the
first match).
11-Apr-19 26
27. • Examples:
<script>
var str = "Visit Mypage";
var patt1 = /mypage/i;
document.write(str.match(patt1));
</script>
<script>
var str="Is this all there is?";
var patt1=/is/g;
document.write(str.match(patt1));
</script>
<script>
var str="Is this all there is?";
var patt1=/is/gi;
document.write(str.match(patt1));
</script>
Mypage
is,is
Is,is,is
11-Apr-19 27
29. <script>
var str="Hello world!";
//look for "Hello"
var patt=/Hello/g;
var result=patt.test(str);
document.write("Returned value: " + result);
//look for “good"
patt=/good/g;
result=patt.test(str);
document.write("<br>Returned value: " + result);
</script>
Returned value: true
Returned value: false
<script>
var str="Hello world!";
//look for "Hello"
var patt=/Hello/g;
var result=patt.exec(str);
document.write("Returned value: " + result);
//look for "W3Schools"
patt=/W3Schools/g;
result=patt.exec(str);
document.write("<br>Returned value: " + result);
</script>
Returned value: Hello
Returned value: null
11-Apr-19 29
33. <script>
var str="Is this all there is?";
var patt1=/[a-h]/g;
document.write(str.match(patt1));
</script>
h,a,h,e,e
<script>
var str="Is this all there is?";
var patt1=/[^a-h]/g;
document.write(str.match(patt1));
</script>
I,s, ,t,i,s, ,l,l, ,t,r, ,i,s,?
<script>
var str="Give 100%!";
var patt1=/w/g;
document.write(str.match(patt1));
</script>
G,i,v,e,1,0,0
<script>
var str="Give 100%!";
var patt1=/W/g;
document.write(str.match(patt1));
</script>
,%,!
11-Apr-19 33
34. <script language="JavaScript1.2">
function checkpostal()
{
var re5digit=/^d{5}$/ //regular expression defining a 5 digit number
if (document.myform.myinput.value.search(re5digit)==-1) //if match failed
alert("Please enter a valid 5 digit number inside form")
}
</script>
<form name="myform">
<input type="text" name="myinput" size=15>
<input type="button" onClick="checkpostal()" value="check">
</form>
•^ indicates the beginning of the string. Using a ^ metacharacter requires that the
match start at the beginning.
•d indicates a digit character and the {5} following it means that there must be 5
consecutive digit characters.
•$ indicates the end of the string. Using a $ metacharacter requires that the match
end at the end of the string.
11-Apr-19 34
35. var string1="Peter has 8 dollars and Jane has 15"
parsestring1=string1.match(/d+/g) //returns the array [8,15]
var string2="(304)434-5454"
parsestring2=string2.replace(/[()-]/g, "") //Returns "3044345454" (removes "(", ")", and "-
")
var string3="1,2, 3, 4, 5"
parsestring3=string3.split(/s*,s*/) //Returns the array ["1","2","3","4","5"]11-Apr-19 35
38. • With the HTML DOM, JavaScript can access all the elements of an HTML document.
• What is the Document Object Model?
The W3C Document Object Model (DOM) is a platform and language-neutral
interface that allows programs and scripts to dynamically access and update the
content, structure, and style of a document.
It defines the logical structure of documents and the way a document is accessed
and manipulated. In the DOM specification, the term "document" is used in the broad
sense.
With the Document Object Model, programmers can create and build documents,
navigate their structure, and add, modify, or delete elements and content. Anything
found in an HTML or XML document can be accessed, changed, deleted, or added using
the Document Object Model, with a few exceptions
The Document Object Model (DOM) is the model that describes how all elements
in an HTML page, like input fields, images, paragraphs etc., are related to the topmost
structure: the document itself. By calling the element by its proper DOM name, we
can influence it.11-Apr-19 38
39. • With a programmable object model, JavaScript gets all the power it needs to create
dynamic HTML:
JavaScript can change all the HTML elements in the page
JavaScript can change all the HTML attributes in the page
JavaScript can change all the CSS styles in the page
JavaScript can react to all the events in the page
JavaScript can remove existing HTML elements and attributes
JavaScript can add new HTML elements and attributes
JavaScript can create new HTML events in the page
HTML DOM defines:
The HTML elements as objects
The properties of all HTML elements
The methods to access all HTML elements
The events for all HTML element
11-Apr-19 39
40. HTML DOM Methods
• HTML DOM methods are actions you can perform (on HTML
Elements).
• HTML DOM properties are values (of HTML Elements) that you
can set or change.
• document.getElementById("demo").innerHTML = "Hello
World!";
11-Apr-19 40
41. HTML DOM Document Object
• Adding and Deleting Elements
• Adding Events Handlers
Method Description
document.createElement(element) Create an HTML element
document.removeChild(element) Remove an HTML element
document.appendChild(element) Add an HTML element
document.replaceChild(new, old) Replace an HTML element
document.write(text) Write into the HTML output stream
Method Description
document.getElementById(id).onclick =
function(){code}
Adding event handler code to an onclick event
11-Apr-19 41
42. HTML DOM Document Object
• Finding HTML Elements
• Changing HTML Elements
document.getElementById(id) Find an element by element id
document.getElementsByTagName(name) Find elements by tag name
document.getElementsByClassName(name) Find elements by class name
Property Description
element.innerHTML = new html content Change the inner HTML of an element
element.attribute= new value Change the attribute value of an HTML element
element.style.property= new style Change the style of an HTML element
Method Description
element.setAttribute(attribute, value) Change the attribute value of an HTML element
11-Apr-19 42
43. HTML DOM Elements
• Finding HTML Elements
– Often, with JavaScript, you want to manipulate HTML
elements.
• Finding HTML elements by id
• Finding HTML elements by tag name
• Finding HTML elements by class name
• Finding HTML elements by CSS selectors
• Finding HTML elements by HTML object collections
• var myElement = document.getElementById("intro");
• var x = document.getElementsByTagName("p");
11-Apr-19 43
44. • Nodes
In the Level 1 DOM, each object, whatever it may be exactly, is a Node. So if you do
<P>This is a paragraph</P>
you have created two nodes: an element P and a text node with content 'This is a
paragraph'. The text node is inside the element, so it is considered a child node of the
element.
<P> <-- element node
|
|
This is a paragraph <-- text node
<P>This is a <B>paragraph</B></P>
<P>
|
--------------
| |
This is a <B>
|
|
paragraph
11-Apr-19 44
46. To do so, you have to find the elements first. There are a couple of ways to do this:
Finding HTML elements by id
Finding HTML elements by tag name
Finding HTML elements by class name
The following HTML objects (and object collections) are also accessible:
document.anchors
document.body
document.documentElement
document.embeds
document.forms
document.head
document.images
document.links
document.scripts
document.title
(1)
<body>
<p id="intro">Hello World!</p>
<p>This example demonstrates the <b>getElementById</b> method!</p>
<script>
x=document.getElementById("intro");
document.write("<p>The text from the intro paragraph: " + x.innerHTML + "</p>");
</script>
11-Apr-19 46
47. (2)
<body>
<p>Hello World!</p>
<div id="main">
<p>The DOM is very useful.</p>
<p>This example demonstrates the <b>getElementsByTagName</b> method</p>
</div>
<script>
var x=document.getElementById("main");
var y=x.getElementsByTagName("p");
document.write('First paragraph inside "main" is ' + y[0].innerHTML);
</script>
</body>
(3)
<p id="p1">Hello World!</p>
<script>
document.getElementById("p1").innerHTML="New text!";
</script>
<p>The paragraph above was changed by a script.</p>
11-Apr-19 47
48. (5)
<body>
<img id="image" src="smiley.gif" width="160" height="120">
<script>
document.getElementById("image").src="landscape.jpg";
</script>
<p>The original image was smiley.gif, but the script changed it to landscape.jpg</p>
</body>
The HTML document above contains an <img> element with id="image"
We use the HTML DOM to get the element with id="image"
A JavaScript changes the src attribute of that element from "smiley.gif" to
"landscape.jpg“
(6)
<p id="p1">Hello World!</p>
<p id="p2">Hello World!</p>
<script>
document.getElementById("p2").style.color="blue";
document.getElementById("p2").style.fontFamily="Arial";
document.getElementById("p2").style.fontSize="larger";
</script>
<p>The paragraph above was changed by a script.</p>
11-Apr-19 48
49. (7)
<body>
<h1 id="id1">My Heading 1</h1>
<button type="button"
onclick="document.getElementById('id1').style.color='red'">
Click Me!</button>
</body>
(8)
<p>Hello World!</p>
<p class="intro">The DOM is very useful.</p>
<p class="intro">This example demonstrates the <b>getElementsByClassName</b>
method.</p>
<p id="demo"></p>
<script>
var x = document.getElementsByClassName("intro");
document.getElementById("demo").innerHTML =
'The first paragraph (index 0) with class="intro": ' + x[0].innerHTML;
</script>
11-Apr-19 49
50. (9)
<body>
<form id="frm1" action="/action_page.php">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br><br>
<input type="submit" value="Submit">
</form>
<p>Click "Try it" to display the value of each element in the form.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.forms["frm1"];
var text = "";
var i;
for (i = 0; i < x.length ;i++) {
text += x.elements[i].value + "<br>";
}
document.getElementById("demo").innerHTML = text;
}
</script>
</body>
11-Apr-19 50
51. HTML DOM Events
• Reacting to Events
• A JavaScript can be executed when an event occurs, like
when a user clicks on an HTML element.
• To execute code when a user clicks on an element, add
JavaScript code to an HTML event attribute: onclick = JS
• HTML events:
• When a user clicks the mouse
• When a web page has loaded
• When an image has been loaded
• When the mouse moves over an element
• When an input field is changed
• When an HTML form is submitted
• When a user strokes a key11-Apr-19 51
52. Example
(1)
<body>
<h1 onclick="this.innerHTML = 'Ooops!'">Click on this text!</h1>
</body>
(2)
<body>
<h1 onclick="changeText(this)">Click on this text!</h1>
<script>
function changeText(id) {
id.innerHTML = "Ooops!";
}
</script>
</body>
11-Apr-19 52
53. Example
(3)
<body>
<p>Click the button to display the
date.</p>
<button onclick="displayDate()">The
time is?</button>
<script>
function displayDate() {
document.getElementById("demo").in
nerHTML = Date();
}
</script>
<p id="demo"></p></body>
(4)
<body>
<p>Click "Try it" to execute the
displayDate() function.</p>
<button id="myBtn">Try it</button>
<p id="demo"></p>
<script>
document.getElementById("myBtn").o
nclick = displayDate;
function displayDate() {
document.getElementById("demo").in
nerHTML = Date();
}
</script></body>
11-Apr-19 53
54. Example
<body onload="checkCookies()">
<p id="demo"></p>
<script>
function checkCookies() {
var text = "";
if (navigator.cookieEnabled == true) {
text = "Cookies are enabled.";
} else {
text = "Cookies are not enabled.";
}
document.getElementById("demo").in
nerHTML = text;
}
</script></body>
<script>
function myFunction() {
var x =
document.getElementById("fname");
x.value = x.value.toUpperCase();
}
</script>
</head>
<body>
Enter your name: <input type="text"
id="fname"
onchange="myFunction()">
</body>
11-Apr-19 54
55. Example
<body>
<div onmouseover="mOver(this)"
onmouseout="mOut(this)"
style="background-
color:#D94A38;width:120px;height:20
px;padding:40px;">
Mouse Over Me</div>
<script>
function mOver(obj) {
obj.innerHTML = "Thank You"
}
function mOut(obj) {
obj.innerHTML = "Mouse Over Me"
}
</script></body>
<div onmousedown="mDown(this)"
onmouseup="mUp(this)"
style="background-
color:#D94A38;width:90px;height:20px;p
adding:40px;">
Click Me</div>
<script>
function mDown(obj) {
obj.style.backgroundColor = "#1ec5e5";
obj.innerHTML = "Release Me";
}
function mUp(obj) {
obj.style.backgroundColor="#D94A38";
obj.innerHTML="Thank You";
}
</script>11-Apr-19 55
56. Example
<form id="myForm" action="#">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
<input type="submit" value="Submit">
</form>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myForm").elements[0].value;
document.getElementById("demo").innerHTML = x;}
</script>
11-Apr-19 56
58. • The window object is supported by all browsers. It represent the browser's window.
• All global JavaScript objects, functions, and variables automatically become members of
the window object.
• Global variables are properties of the window object.
• Global functions are methods of the window object.
11-Apr-19 58
59. Window Screen
• The window.screen object can be written without the window prefix.
Some properties:
• screen.availWidth - available screen width
• screen.availHeight - available screen height
<script>
document.write("Available Width: " + screen.availWidth);
</script>
The output of the code above will be: Available Width: 1366
11-Apr-19 59
60. Window Location
• The window.location object can be written without the window prefix.
Some examples:
• location.hostname returns the domain name of the web host
• location.pathname returns the path and filename of the current page
• location.port returns the port of the web host (80 or 443)
• location.protocol returns the web protocol used (http:// or https://)
11-Apr-19 60
61. The location.assign() method loads a new document.
<html>
<head>
<script>
function newDoc()
{
window.location.assign(“C:Documents and SettingsAdministratorDesktopa1.html")
}
</script>
</head>
<body>
<input type="button" value="Load new document" onclick="newDoc()">
</body>
</html>
11-Apr-19 61
62. Window History
• The window.history object can be written without the window prefix.
• To protect the privacy of the users, there are limitations to how JavaScript can access
this object.
Some methods:
• history.back() - same as clicking back in the browser
• history.forward() - same as clicking forward in the browser
<html>
<head>
<script>
function goBack()
{
window.history.back()
}
</script>
</head>
<body>
<input type="button" value="Back" onclick="goBack()“> </body> </html>
11-Apr-19 62