JavaScript can dynamically manipulate the content, structure, and styling of an HTML document through the Document Object Model (DOM). The DOM represents an HTML document as nodes that can be accessed and modified with JavaScript. Common tasks include dynamically creating and adding elements, handling user events like clicks, and updating content by accessing DOM elements by their id or other attributes.
The document discusses JavaScript events and event handling. It covers the different phases of events, how to define event handlers, the event object, and how to cancel bubbling and override default browser actions. It also provides examples of handling mouse and keyboard events, such as changing an element's style on mouseover and logging key events.
JQuery is a JavaScript library that simplifies HTML document manipulation, event handling, animations, and Ajax interactions. It works across browsers and makes tasks like DOM traversal and manipulation, event handling, animation, and Ajax much simpler. JQuery's versatility, extensibility, and cross-browser compatibility have made it popular, with millions of developers using it to write JavaScript.
JavaScript is a client-side scripting language that can be inserted into HTML pages to make them interactive. It allows dynamic validation of forms, changing HTML element properties like visibility, and reacting to user events like clicks or form submissions. The Document Object Model (DOM) represents an HTML or XML document as a tree structure, allowing JavaScript to programmatically access and modify the content, structure, and styling of the document. Common built-in JavaScript objects include String, Date, Array, Math, and Boolean, which provide properties and methods for manipulating text, dates, lists of values, numbers, and true/false values.
This document provides an introduction to JavaScript, covering basic concepts like data types, variables, operators, conditionals, loops, functions, arrays, and objects. It explains that JavaScript is an interpreted language that allows dynamic and interactive functionality on websites. Key points are demonstrated through examples, like using alert to output "Hello World" and basic math operations with variables.
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...Edureka!
( ** Full Stack Web Development Training: https://www.edureka.co/masters-program/full-stack-developer-training ** )
This Edureka tutorial on JavaScript explains all the fundamentals of JavaScript with examples. It also explains various features and applications of JavaScript. Following are the topics included in this tutorial:
1. What Is JavaScript?
2. Why Use JavaScript
3. JavaScript Fundamentals
- Data Types
- Variables
- Constants
- Loops
- Conditional Statements
- Functions
JavaScript is a scripting language that allows adding interactivity to HTML pages. It can be used for client-side form validation and integration with user plugins. JavaScript is case-sensitive and allows variables, functions, conditional statements, and objects. Common uses include pop-up boxes, event handling, and cookies.
The document summarizes key aspects of using JavaScript with the DOM:
1) The DOM represents the document as nodes that can be accessed and manipulated with JavaScript. Common methods are getElementById() and getElementsByTagName() to select nodes, and createElement() to generate new nodes.
2) Events allow JavaScript to react to user actions. Event handlers can be assigned to nodes using onclick attributes or addEventListener(). Events bubble up the DOM tree by default but can be stopped from propagating with stopPropagation().
3) The this keyword refers to the "owner" or context of the executing function, such as the HTML element to which an event handler is assigned. Understanding this is important for manipulating nodes from
Form using html and java script validationMaitree Patel
This document discusses form validation using HTML and JavaScript. It begins with an introduction to HTML forms, form elements like <input>, and common form controls such as text, checkbox, radio buttons and selects. It then covers JavaScript form validation, explaining why validation is needed and providing an example that validates form fields like name, email and zip code on submit. The example uses JavaScript to check for empty fields and invalid email and zip code formats before allowing form submission.
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
The document provides an overview of HTML, CSS, JavaScript and jQuery. It describes what each technology is, examples of common tags and syntax, and how they are used together. HTML is a markup language used to define the structure and layout of web pages using tags. CSS is used to style and lay out HTML elements, and can be linked externally or embedded internally or inline. JavaScript can be used to add interactive elements and dynamic behavior to HTML pages client-side. jQuery is a JavaScript library that simplifies tasks like HTML document traversal and manipulation, events, animations and Ajax.
The document provides an overview of Bootstrap, including:
- Bootstrap is an open-source HTML, CSS, and JS framework for developing responsive mobile-first websites and web apps.
- It contains utilities for typography, forms, buttons, navigation, and other interface components, as well as optional JavaScript extensions.
- The document describes various Bootstrap components like grids, navigation, buttons, forms, images, alerts, progress bars, and panels. It provides code examples for how to implement these components.
JavaScript was designed to add interactivity to HTML pages. It is a scripting language that is usually embedded directly into HTML pages and allows for dynamic text, event handling, reading/writing HTML elements, and validating form data. JavaScript supports both client-side and server-side scripting and was originally developed by Netscape under the name LiveScript before being renamed. It provides programming capabilities to HTML authors and allows for dynamic content, user interaction, and validation without server requests.
HTML5 is the newest version of HTML that adds new semantic elements, built-in audio and video playback, and features like the canvas element for drawing graphics. It simplifies the syntax of earlier HTML versions and aims to make web pages more semantic, reduce the need for plugins, and work across devices. New elements in HTML5 include <header>, <footer>, <nav>, <video>, <audio>, <canvas>, and new form input types. It is still a work in progress with partial browser support.
This document discusses JavaScript events. It defines an event as an action a script can respond to, such as clicks or keystrokes. Event handlers are functions assigned to events that run when the event occurs. Events follow a cycle of capturing, targeting, and bubbling. Common event types include mouse, keyboard, loading, selection, and other events. The document provides examples of using event handlers with buttons, images, and adding/removing event listeners.
Introduction to Cascading Style Sheets (CSS)Chris Poteet
This document provides an introduction to Cascading Style Sheets (CSS) including definitions, why CSS is used, the cascade, inheritance, using style sheets, CSS syntax, selectors, the box model, CSS and the semantic web, browser acceptance, fonts, units, colors, layouts, text formatting, backgrounds, lists, shorthand properties, accessibility, and resources for further information.
This presentation is an introduction to the new features of
HTML5. The main elements of this document are:
* Brief history of HTML5
*The improvements
* Browser support
* Semantic elements
* Content Editable on pages
* Video Tag
* Canvas tag
* Local storage
* Geolocation API
* Offline applications
* Microdata
* Use cases
What is the DOM?
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents:
"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."
The W3C DOM standard is separated into 3 different parts:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects.
With the HTML DOM, JavaScript can access and change all the elements of an HTML document.
Arrays in JavaScript can be used to store multiple values in a single variable. Arrays are objects with numeric indexes and various methods that can be used to modify arrays. Some key array methods include concat(), join(), push(), pop(), unshift(), shift(), sort(), reverse(), slice(), splice(), indexOf(), lastIndexOf(), and length. Arrays are dynamically typed and sparse, allowing elements to contain values of any type.
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 how to script the DOM using JavaScript. It discusses how the browser parses HTML into a DOM tree, with the window and document objects being the root nodes. It then explains how to access and manipulate DOM elements using the body, JavaScript functions, and events. Finally, it covers creating custom objects and namespacing in JavaScript.
Basic Java script handouts for students shafiq sangi
The document provides an overview of JavaScript, including:
- JavaScript was created in 1995 by Brendan Eich at Netscape to allow for client-side scripting capabilities in web pages.
- JavaScript is an interpreted scripting language that is lightweight and enables dynamic interactions and validations on web pages.
- Common uses of JavaScript include client-side form validation, dynamic content display, and creating interactive elements like dropdown menus and pop-up windows.
- The document then covers JavaScript basics like variables, data types, conditional statements, loops, and functions. Examples are provided for each concept.
JavaScript is a client-side scripting language that is commonly used to add interactivity to web pages. The Document Object Model (DOM) represents the structure of an HTML/XML document and allows JavaScript to dynamically access and update the content, structure, and styling of a document. Asynchronous JavaScript and XML (AJAX) is a set of web development techniques that allow web pages to be updated asynchronously by exchanging data with a web server behind the scenes, without reloading the entire page. jQuery is a popular JavaScript library that simplifies tasks like HTML document traversal and manipulation, events, animations, and Ajax interactions for rapid web development.
The document provides an overview of JavaScript for a beginner audience. It discusses what JavaScript is, why it is used, examples of its capabilities, and how to write JavaScript code. The session will demonstrate JavaScript capabilities, explain code samples, and answer questions. JavaScript allows dynamic functionality on web pages by manipulating the browser and document object model (DOM).
This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise.
New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.
Client side scripting using JavascriptBansari Shah
The document discusses client-side scripting with JavaScript. It defines what a script is and notes that JavaScript is the main scripting language used for client-side scripting in web browsers. It describes how JavaScript can be used to add interactivity to HTML pages by dynamically updating content. The document also provides details on JavaScript statements, variables, functions, events, and how to access and modify the DOM using the document object model.
This document provides summaries of key points about the jQuery and Prototype JavaScript libraries:
1. jQuery is an open-source JavaScript library that simplifies HTML document traversal, event handling, animation, and Ajax interactions. It has a lightweight footprint and is cross-browser compatible.
2. Both jQuery and Prototype are available under MIT and GPL licenses, allowing developers to choose the license that best suits their projects. jQuery is maintained by a core team and has additional community support.
3. The document then provides examples of common jQuery functions and selectors for manipulating the DOM, handling events, animating elements, and making Ajax requests.
This document provides summaries of key points about the jQuery and Prototype JavaScript libraries:
1. jQuery is an open-source JavaScript library that simplifies HTML document traversal, event handling, animation, and Ajax interactions. It has a lightweight footprint and is cross-browser compatible.
2. Both jQuery and Prototype are available under MIT and GPL licenses, allowing developers to choose the license that best suits their projects. jQuery is maintained by a core team and has additional community support.
3. The document then provides examples of common jQuery functions and selectors for manipulating the DOM, handling events, animating elements, and making Ajax requests.
This document provides an overview of JavaScript, including:
- JavaScript is a client-side scripting language designed for web pages, created by Brendan Eich in 1995.
- It can modify HTML content, respond to events, validate forms, and detect browser capabilities. JavaScript code can reside in external files or HTML tags.
- Key JavaScript concepts include objects, properties, events, functions, variables, and operators. Objects represent elements like windows and forms. Properties modify objects. Events trigger JavaScript code. Functions perform tasks. Variables store values. Operators manipulate values.
The document provides an overview of JavaScript and the Document Object Model (DOM). It introduces JavaScript as a scripting language used to add interactivity and dynamic behavior to web pages. It describes how JavaScript can be implemented in HTML using <script> tags in the head or body, or externally in .js files. The document then covers JavaScript syntax including data types, operators, conditional statements, loops, functions. It also discusses the DOM and how JavaScript can manipulate HTML elements and attributes.
This document provides an overview of JavaScript, including what JavaScript is, how it is used, and some key JavaScript concepts. It defines JavaScript as the scripting language of the web that is used to add interactivity and functionality to HTML pages. The document outlines JavaScript statements, variables, operators, events, and error handling. It also discusses how JavaScript can interact with HTML elements, validate forms, detect the browser, and use cookies. The last few sections cover the navigator object and how JavaScript can retrieve information about the user's browser.
JavaScript is a scripting language used to make web pages interactive. It runs on the user's browser and allows webpages to be dynamic and interactive by accessing and modifying page elements. JavaScript is commonly used to create effects like polls and quizzes and handle events like clicking buttons. Functions allow code to be reused and modularized for easier maintenance. The example JavaScript program defines a function to validate a login form by checking that required fields are entered and meet certain criteria before submitting.
Introduction to Javascript programmingFulvio Corno
The document provides an introduction to client-side programming using JavaScript. It discusses how JavaScript can be used to add interactivity to web pages by manipulating the HTML document object model directly in the browser. It covers the basics of the JavaScript language including variables, data types, operators, and control structures. It also introduces common JavaScript objects like Date, String, Array, and Math that are used to work with dates, strings, arrays of values and mathematical functions respectively. The document provides examples of how to define and call functions in JavaScript.
This document provides an introduction to JavaScript by explaining what it is, how it differs from Java, how it works within web browsers to make pages interactive, and some common uses of JavaScript including form validation and manipulating HTML elements. It discusses how JavaScript code is embedded in HTML pages and executed on the client-side, and provides some simple examples of JavaScript statements and using JavaScript with HTML forms.
Yeoman is a robust and opinionated client-side stack, comprising tools and frameworks that can help developers quickly build beautiful web applications.
This document provides an overview of Grunt, a JavaScript task runner. It discusses that Grunt allows automation of tasks like testing, linting, minification and more. Key points include that Grunt is open source, has a large community and plugins, and makes development easier by automating repetitive tasks. The document demonstrates how to install Grunt and its plugins via npm, and how to configure a Gruntfile to define and run tasks. Major companies and projects like jQuery, Yeoman and Twitter are highlighted as using Grunt.
This presentation summarizes the management and prevention of Thalassemia. [1] Thalassemia Major is a blood disorder where the bone marrow cannot produce sufficient red blood cells or keep them alive, requiring lifelong blood transfusions. [2] Regular transfusions lead to iron overload without chelation therapy, damaging vital organs. [3] Prevention relies on public awareness of carrier screening and antenatal diagnosis to reduce the 8,000-10,000 new Thalassemia Major cases born in India each year.
The document discusses Model-View-Controller (MVC) architecture and Backbone.js. It defines MVC as separating a web application into three parts: the model (data), view (presentation), and controller (user interaction). It explains that Backbone.js implements an MVC-like structure using models, views, and routers to organize JavaScript code. The document also introduces JavaScript templating as a way to render templates with data bindings into the HTML DOM.
The document discusses HTML5 Boilerplate, an open source front-end template for building websites. It provides a starting point with modernizr, optimized defaults, and best practices. The document outlines what HTML5 Boilerplate is, who uses it, why it's useful, where to get it, and key things to know about using its build script to optimize files for production.
The document discusses the jQuery framework, explaining why jQuery should be used, what the $() function does, how to write unobtrusive JavaScript, and how to extend jQuery through plugins. It also covers using jQuery with other libraries by relinquishing control of the $ variable through the $.noConflict() method. Key features of jQuery include its small file size, cross-browser compatibility, and ease of selecting, manipulating, and animating elements.
7 Most Powerful Solar Storms in the History of Earth.pdfEnterprise Wired
Solar Storms (Geo Magnetic Storms) are the motion of accelerated charged particles in the solar environment with high velocities due to the coronal mass ejection (CME).
Kief Morris rethinks the infrastructure code delivery lifecycle, advocating for a shift towards composable infrastructure systems. We should shift to designing around deployable components rather than code modules, use more useful levels of abstraction, and drive design and deployment from applications rather than bottom-up, monolithic architecture and delivery.
UiPath Community Day Kraków: Devs4Devs ConferenceUiPathCommunity
We are honored to launch and host this event for our UiPath Polish Community, with the help of our partners - Proservartner!
We certainly hope we have managed to spike your interest in the subjects to be presented and the incredible networking opportunities at hand, too!
Check out our proposed agenda below 👇👇
08:30 ☕ Welcome coffee (30')
09:00 Opening note/ Intro to UiPath Community (10')
Cristina Vidu, Global Manager, Marketing Community @UiPath
Dawid Kot, Digital Transformation Lead @Proservartner
09:10 Cloud migration - Proservartner & DOVISTA case study (30')
Marcin Drozdowski, Automation CoE Manager @DOVISTA
Pawel Kamiński, RPA developer @DOVISTA
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
09:40 From bottlenecks to breakthroughs: Citizen Development in action (25')
Pawel Poplawski, Director, Improvement and Automation @McCormick & Company
Michał Cieślak, Senior Manager, Automation Programs @McCormick & Company
10:05 Next-level bots: API integration in UiPath Studio (30')
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
10:35 ☕ Coffee Break (15')
10:50 Document Understanding with my RPA Companion (45')
Ewa Gruszka, Enterprise Sales Specialist, AI & ML @UiPath
11:35 Power up your Robots: GenAI and GPT in REFramework (45')
Krzysztof Karaszewski, Global RPA Product Manager
12:20 🍕 Lunch Break (1hr)
13:20 From Concept to Quality: UiPath Test Suite for AI-powered Knowledge Bots (30')
Kamil Miśko, UiPath MVP, Senior RPA Developer @Zurich Insurance
13:50 Communications Mining - focus on AI capabilities (30')
Thomasz Wierzbicki, Business Analyst @Office Samurai
14:20 Polish MVP panel: Insights on MVP award achievements and career profiling
Implementations of Fused Deposition Modeling in real worldEmerging Tech
The presentation showcases the diverse real-world applications of Fused Deposition Modeling (FDM) across multiple industries:
1. **Manufacturing**: FDM is utilized in manufacturing for rapid prototyping, creating custom tools and fixtures, and producing functional end-use parts. Companies leverage its cost-effectiveness and flexibility to streamline production processes.
2. **Medical**: In the medical field, FDM is used to create patient-specific anatomical models, surgical guides, and prosthetics. Its ability to produce precise and biocompatible parts supports advancements in personalized healthcare solutions.
3. **Education**: FDM plays a crucial role in education by enabling students to learn about design and engineering through hands-on 3D printing projects. It promotes innovation and practical skill development in STEM disciplines.
4. **Science**: Researchers use FDM to prototype equipment for scientific experiments, build custom laboratory tools, and create models for visualization and testing purposes. It facilitates rapid iteration and customization in scientific endeavors.
5. **Automotive**: Automotive manufacturers employ FDM for prototyping vehicle components, tooling for assembly lines, and customized parts. It speeds up the design validation process and enhances efficiency in automotive engineering.
6. **Consumer Electronics**: FDM is utilized in consumer electronics for designing and prototyping product enclosures, casings, and internal components. It enables rapid iteration and customization to meet evolving consumer demands.
7. **Robotics**: Robotics engineers leverage FDM to prototype robot parts, create lightweight and durable components, and customize robot designs for specific applications. It supports innovation and optimization in robotic systems.
8. **Aerospace**: In aerospace, FDM is used to manufacture lightweight parts, complex geometries, and prototypes of aircraft components. It contributes to cost reduction, faster production cycles, and weight savings in aerospace engineering.
9. **Architecture**: Architects utilize FDM for creating detailed architectural models, prototypes of building components, and intricate designs. It aids in visualizing concepts, testing structural integrity, and communicating design ideas effectively.
Each industry example demonstrates how FDM enhances innovation, accelerates product development, and addresses specific challenges through advanced manufacturing capabilities.
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...Toru Tamaki
Jindong Gu, Zhen Han, Shuo Chen, Ahmad Beirami, Bailan He, Gengyuan Zhang, Ruotong Liao, Yao Qin, Volker Tresp, Philip Torr "A Systematic Survey of Prompt Engineering on Vision-Language Foundation Models" arXiv2023
https://arxiv.org/abs/2307.12980
Measuring the Impact of Network Latency at TwitterScyllaDB
Widya Salim and Victor Ma will outline the causal impact analysis, framework, and key learnings used to quantify the impact of reducing Twitter's network latency.
Comparison Table of DiskWarrior Alternatives.pdfAndrey Yasko
To help you choose the best DiskWarrior alternative, we've compiled a comparison table summarizing the features, pros, cons, and pricing of six alternatives.
Quantum Communications Q&A with Gemini LLM. These are based on Shannon's Noisy channel Theorem and offers how the classical theory applies to the quantum world.
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfNeo4j
Presented at Gartner Data & Analytics, London Maty 2024. BT Group has used the Neo4j Graph Database to enable impressive digital transformation programs over the last 6 years. By re-imagining their operational support systems to adopt self-serve and data lead principles they have substantially reduced the number of applications and complexity of their operations. The result has been a substantial reduction in risk and costs while improving time to value, innovation, and process automation. Join this session to hear their story, the lessons they learned along the way and how their future innovation plans include the exploration of uses of EKG + Generative AI.
Coordinate Systems in FME 101 - Webinar SlidesSafe Software
If you’ve ever had to analyze a map or GPS data, chances are you’ve encountered and even worked with coordinate systems. As historical data continually updates through GPS, understanding coordinate systems is increasingly crucial. However, not everyone knows why they exist or how to effectively use them for data-driven insights.
During this webinar, you’ll learn exactly what coordinate systems are and how you can use FME to maintain and transform your data’s coordinate systems in an easy-to-digest way, accurately representing the geographical space that it exists within. During this webinar, you will have the chance to:
- Enhance Your Understanding: Gain a clear overview of what coordinate systems are and their value
- Learn Practical Applications: Why we need datams and projections, plus units between coordinate systems
- Maximize with FME: Understand how FME handles coordinate systems, including a brief summary of the 3 main reprojectors
- Custom Coordinate Systems: Learn how to work with FME and coordinate systems beyond what is natively supported
- Look Ahead: Gain insights into where FME is headed with coordinate systems in the future
Don’t miss the opportunity to improve the value you receive from your coordinate system data, ultimately allowing you to streamline your data analysis and maximize your time. See you there!
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Erasmo Purificato
Slide of the tutorial entitled "Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Emerging Trends" held at UMAP'24: 32nd ACM Conference on User Modeling, Adaptation and Personalization (July 1, 2024 | Cagliari, Italy)
YOUR RELIABLE WEB DESIGN & DEVELOPMENT TEAM — FOR LASTING SUCCESS
WPRiders is a web development company specialized in WordPress and WooCommerce websites and plugins for customers around the world. The company is headquartered in Bucharest, Romania, but our team members are located all over the world. Our customers are primarily from the US and Western Europe, but we have clients from Australia, Canada and other areas as well.
Some facts about WPRiders and why we are one of the best firms around:
More than 700 five-star reviews! You can check them here.
1500 WordPress projects delivered.
We respond 80% faster than other firms! Data provided by Freshdesk.
We’ve been in business since 2015.
We are located in 7 countries and have 22 team members.
With so many projects delivered, our team knows what works and what doesn’t when it comes to WordPress and WooCommerce.
Our team members are:
- highly experienced developers (employees & contractors with 5 -10+ years of experience),
- great designers with an eye for UX/UI with 10+ years of experience
- project managers with development background who speak both tech and non-tech
- QA specialists
- Conversion Rate Optimisation - CRO experts
They are all working together to provide you with the best possible service. We are passionate about WordPress, and we love creating custom solutions that help our clients achieve their goals.
At WPRiders, we are committed to building long-term relationships with our clients. We believe in accountability, in doing the right thing, as well as in transparency and open communication. You can read more about WPRiders on the About us page.
Best Programming Language for Civil EngineersAwais Yaseen
The integration of programming into civil engineering is transforming the industry. We can design complex infrastructure projects and analyse large datasets. Imagine revolutionizing the way we build our cities and infrastructure, all by the power of coding. Programming skills are no longer just a bonus—they’re a game changer in this era.
Technology is revolutionizing civil engineering by integrating advanced tools and techniques. Programming allows for the automation of repetitive tasks, enhancing the accuracy of designs, simulations, and analyses. With the advent of artificial intelligence and machine learning, engineers can now predict structural behaviors under various conditions, optimize material usage, and improve project planning.
1. JavaScript & DOM Manipulation Mohammed Arif Senior Interactive Developer @ SapientNitro Twitter@ arif_iq Linkedin: http:// in.linkedin.com/in/mohdarif Blog: http:// www.mohammedarif.com
2. Agenda: JavaScript As “the Behavior Layer” JavaScript: What it is and isn't ECMAScript JavaScript: Usage Naming conventions What is the DOM?
3. Before We Start! Important tools to have Firebug for Firefox ( http:// w ww.getfirebug.com ) IE Web Developer Toolbar (handy) ( http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en ) DebugBar for IE ( http:// www.debugbar.com/download.php )
4. JavaScript As “the Behavior Layer”: • The behavior layer : Is executed on the client and defines how different elements behave when the user interacts with them (JavaScript or ActionScript for Flash sites). • The presentation layer : Is displayed on the client and is the look of the web page (CSS, imagery).
5. • The structure layer : Is converted or displayed by the user agent. This is the markup defining what a certain text or media is (XHTML). • The content layer : Is stored on the server and consists of all the text, images, and multimedia content that are used on the site (XML, database, media assets). • The business logic layer (or back end) : Runs on the server and determines what is done with incoming data and what gets returned to the user.
6. JS: What it is and isn’t NOT Java despite its name ECMAScript More than form validation Client-Side Scripting Language Dynamic Object-Based (Prototype-Based) It is an interpreted language
7. ECMAScript: ECMAScript is a scripting programming language, standardized by ECMA International in the ECMA-262 specification. The language is widely used on the web, and is often referred to as JavaScript or JScript. Each browser has its own implementation of the ECMAScript interface, which is then extended to contain the DOM and BOM. There are other languages that also implement and extend ECMAScript such as Windows Scripting Host (WSH), ActionScript in Macromedia Flash, and Nombas ScriptEase.
8. JS: Usage Drop this puppy in your page: <html> <head> <title>Example JS Page</title> <script language=”JavaScript”> <!-- hide from older browsers function sayHi() { alert(“Hi”); } //--> </script> <noscript> <p>Your browser doesn’t support JavaScript. If it did support JavaScript, you would see this message: Hi!</p> </noscript> </head> <body> </body> </html> Example: However, noscript is deprecated in XHTML and strict} HTML, and there is no need for it—if you create JavaScript that is unobtrusive.
9. Naming conventions Camel Notation — the first letter is lowercase and each appended word begins with an uppercase letter. For example: var m y T est V alue = 0, m y S econd T est V alue = “hi”; Pascal Notation —the first letter is uppercase and each appended word begins with an uppercase letter. For example: var M y T est V alue = 0, M y S econd T est V alue = “hi”; Hungarian Type Notation — prepends a lowercase letter (or sequence of lowercase letters) to the beginning of a Pascal Notation variable name to indicate the type of the variable. For example, i means integer and s means string in the following line: var iM y T est V alue = 0, sM y S econd T est V alue = “hi”;
10. JS: Literals The following are literals…each variable is literally the data assigned. JavaScript does not have strict data types <script type=“text/javascript”> var myNumber = 123; var myString = ‘Bork!’; var myBoolean = true; var myFunction = function(){ return ‘hello’;} //anonymous function var myArray = [1, 2, 3]; </script>
11. Variables Scope There are two types of variables: Local variables Are created within a function Only recognized within that function Multiple functions can use the same local variable name without error Global variables Are available everywhere Names must be unique How do you create a local or a global function? Created inside a function: Declared with “var” it’s local Without “var” and it’s global Created outside of a function, it’s always global
12. JS: Objects Everything in JS is an Object Those literals can be written: <script type=“text/javascript”> var myNumber = new Number(123); var myString = new String(‘Rayyan’); var myBoolean = new Boolean(true); var myFunction = new Function(‘’, “return ‘hello’”);} var myRegExp = new RegExp(‘bork’); var myArray = new Array(); myArray[0] = 1; myArray[1] = 2; myArray[2] = 3; var myCarObject = new Object(); myCarObject.color = ‘red’; myCarObject.tires = 4; myCarObject.windows = 6; </script>
13. JS: Control Structures if (condition) { //... } else { //... } while (condition) { //... } for (var i = 0; i< 10; i++) { //... } for (var element in array_of_elements) { //... } do { //... } while (condition); switch (param) { case 1: // if param == 1... case 'whee': // if param == 'whee'... case false: // if param == false... default : // otherwise ... } try { //... } catch (err) { //... }
14. What is the DOM? The Document Object Model (DOM) is an application programming interface (API) for HTML as well as XML. The DOM maps out an entire page as a document composed of a hierarchy of nodes. It alter the appearance & content of a page without reloading the document. Each part of an HTML or XML page is a derivative of a node. Consider the following HTML page:
15. DOM == Document Object Model The DOM is hierarchical <html> <head> <title>Example JS Page</title> </head> <body> <div id=“Rayyan”> <ul> <li>Delhi</li> <li>Mumbai</li> <li>Chennai</li> <li>Kolkata</li> </ul> </div> </body> </html>
17. Finding DOM Elements document.getElementById(id) returns a specific element document.getElementsByTagName(DIV) returns an array of elements document.getElementsByName(name) returns a collection of objects with the specified NAME
18. DOM Element Attributes nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument 1 = an HTML element 2 = an element attribute 3 = text 8 = an HTML comment 9 = a document 10 = a document type definition DOM Attributes Node Types (12)
19. Manipulating the DOM Dynamically creating and adding elements document.createElement appendChild
21. Event Handlers/Listeners: With an event handler you can do something with an element when an event occurs: when the user clicks an element, when the page loads, when a form is submitted, etc. To assign an event handler in JavaScript, you have to get a reference to the object in question and then assign a function to the corresponding event handler property like this: var oDiv = document.getElementById(“div1”); oDiv.onclick = function () { alert(“I was clicked”); }; <div onclick=”alert(‘I was clicked’)”></div> &
22. Internet Explorer In IE, every element and window object has two methods: attachEvent() and detachEvent(). var fnClick = function () { alert(“Clicked!”); }; var oDiv = document.getElementById(“div”); oDiv.attachEvent(“onclick”, fnClick); //add the event handler //do some other stuff here oDiv.detachEvent(“onclick”, fnClick); //remove the event handler
23. DOM (Mozilla, Opera, etc.) The DOM methods addEventListener() and removeEventListener() accomplish the assignment and removal of event handlers. These methods, unlike IE, take three parameters: the event name, the function to assign, and whether the handler should be used for the bubbling or capture phase. If the handler is to be used in the capture phase, the third parameter is true; for the bubbling phase, it is false. Here’s the general syntax: [Object]. addEventListener(“name_of_event”, fnHandler, bCapture); [Object]. removeEventListener(“name_of_event”, fnHandler, bCapture); example