SlideShare a Scribd company logo
1 of 11
Download to read offline
SLICING AND PLAYING
WITH HTML
Learning Java Script Editing
What is it?
   Slicing HTML involves playing with the stuff on the
    HTML Page like “divs”, “select boxes”, “input boxes”
    and much-much more
Some key points
   Every element is associated with the ID. ID is used to
    access that object on the HTML page. And
    document.getElementById(“element_name”) will give
    you the power to access that element on the page.
    Now you are just one step away from
    altering/modifying the HTML page.
Key Points Cont…
   document.getElementByTagsName(“div”) will give
    you all the divs on the page. Again one step away
    from editing the page. Isnt is simple?
Key Points Cont…
   Inner HTML can be used to set the content of the
    page. The good/bad thing about Inner html is that
    it over writes what ever content is already
    associated with that element.


             Inner HTML replaces (over rides) already existing
             conetnt.
Document Object Model


                  <html>
                  <head></head>
                  <body>
                          <p id=”story”>
                          Hey
                          <strong>Akshat</strong>
                  </p>
                  </body>
                  </html>
Main Properties to consider in the Dom
tree
   nodeValue
    nodeType
   firstChild
   lastChild
   childNodes
What this refers to in the HTML
   Document.getElementByTagsName(“body”)[0].child
    Nodes[1].lastChild.

   Answer :- strong.



   Refer slide number 6 for HTML
Changing the node text
var node = document.getElementBId(“story”);
while(node.firstchild)
  node.removechild(node.firstchild);
node.appendchild(document.createTextNode(“OK
  Finally”));
Creating a new Element
var paragraph =document.createElement(p) – Just
  specify the tag name here
paragraph.appendchild(document.createTextNode(“T
  he text in the paragraph”));
document.getElementbyId(“story”).appendchild(parag
  raph);
Java Script and HTML.

More Related Content

What's hot

INTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREEINTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREEsystematiclab
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7phuphax
 
JavaScript DOM Manipulations
JavaScript DOM ManipulationsJavaScript DOM Manipulations
JavaScript DOM ManipulationsYnon Perek
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Ayes Chinmay
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用LearningTech
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery BasicsKaloyan Kosev
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQueryShawn Calvert
 
Document Object Model (DOM)
Document Object Model (DOM)Document Object Model (DOM)
Document Object Model (DOM)GOPAL BASAK
 
Java script Advance
Java script   AdvanceJava script   Advance
Java script AdvanceJaya Kumari
 

What's hot (20)

INTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREEINTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREE
 
2.java script dom
2.java script  dom2.java script  dom
2.java script dom
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7
 
Javascript ch8
Javascript ch8Javascript ch8
Javascript ch8
 
JavaScript DOM Manipulations
JavaScript DOM ManipulationsJavaScript DOM Manipulations
JavaScript DOM Manipulations
 
Introduction to the DOM
Introduction to the DOMIntroduction to the DOM
Introduction to the DOM
 
HTML5 Introduction by Dhepthi L
HTML5 Introduction by Dhepthi LHTML5 Introduction by Dhepthi L
HTML5 Introduction by Dhepthi L
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用
 
HTML5 Basics
HTML5 BasicsHTML5 Basics
HTML5 Basics
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Data binding
Data bindingData binding
Data binding
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery Basics
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
 
HTML5
HTML5HTML5
HTML5
 
Document Object Model (DOM)
Document Object Model (DOM)Document Object Model (DOM)
Document Object Model (DOM)
 
Java script Advance
Java script   AdvanceJava script   Advance
Java script Advance
 
JS basics
JS basicsJS basics
JS basics
 
Jquery 2
Jquery 2Jquery 2
Jquery 2
 
Java script
Java scriptJava script
Java script
 

Viewers also liked

Viewers also liked (20)

Lecture 2
Lecture 2Lecture 2
Lecture 2
 
интернетийн ертөнц
интернетийн ертөнцинтернетийн ертөнц
интернетийн ертөнц
 
Button ашиглан хуудас хооронд холбоос хийх
Button ашиглан хуудас хооронд холбоос хийхButton ашиглан хуудас хооронд холбоос хийх
Button ашиглан хуудас хооронд холбоос хийх
 
Pp Lect12 13
Pp Lect12 13Pp Lect12 13
Pp Lect12 13
 
Pp Lect10 11
Pp Lect10 11Pp Lect10 11
Pp Lect10 11
 
Лабораторийн ажил 12
Лабораторийн ажил 12Лабораторийн ажил 12
Лабораторийн ажил 12
 
Pp Lect3 1
Pp Lect3 1Pp Lect3 1
Pp Lect3 1
 
Blog ooad-tod
Blog ooad-todBlog ooad-tod
Blog ooad-tod
 
Pp Lect9
Pp Lect9Pp Lect9
Pp Lect9
 
Pp Lect4
Pp Lect4Pp Lect4
Pp Lect4
 
Pp Lect9 10 1
Pp Lect9 10 1Pp Lect9 10 1
Pp Lect9 10 1
 
Pp Lect13 1
Pp Lect13 1Pp Lect13 1
Pp Lect13 1
 
Dynamic web 13
Dynamic web 13Dynamic web 13
Dynamic web 13
 
Pp Lect8
Pp Lect8Pp Lect8
Pp Lect8
 
D:\Sw207\Lectures Old\Pp Lect0
D:\Sw207\Lectures Old\Pp Lect0D:\Sw207\Lectures Old\Pp Lect0
D:\Sw207\Lectures Old\Pp Lect0
 
Sw203 Lab4
Sw203 Lab4Sw203 Lab4
Sw203 Lab4
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Pp Lect4 5
Pp Lect4 5Pp Lect4 5
Pp Lect4 5
 
Pp Lect8 1
Pp Lect8 1Pp Lect8 1
Pp Lect8 1
 
Хайлтын системийн оновчлол /хялбар/
Хайлтын системийн оновчлол /хялбар/Хайлтын системийн оновчлол /хялбар/
Хайлтын системийн оновчлол /хялбар/
 

Similar to Java Script and HTML.

JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulationborkweb
 
Web Performance Tips
Web Performance TipsWeb Performance Tips
Web Performance TipsRavi Raj
 
Learn html elements and structure cheatsheet codecademy
Learn html  elements and structure cheatsheet   codecademyLearn html  elements and structure cheatsheet   codecademy
Learn html elements and structure cheatsheet codecademynirmalamanjunath
 
Javascript dom event
Javascript dom eventJavascript dom event
Javascript dom eventBunlong Van
 
Document object model
Document object modelDocument object model
Document object modelAmit kumar
 
React Under the Hood: Understanding React’s UI Rendering Process
React Under the Hood: Understanding React’s UI Rendering ProcessReact Under the Hood: Understanding React’s UI Rendering Process
React Under the Hood: Understanding React’s UI Rendering ProcessAll Things Open
 
I have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdfI have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdfmail931892
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponentsCyril Balit
 

Similar to Java Script and HTML. (20)

DOM and Events
DOM and EventsDOM and Events
DOM and Events
 
Web 6 | JavaScript DOM
Web 6 | JavaScript DOMWeb 6 | JavaScript DOM
Web 6 | JavaScript DOM
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Web Performance Tips
Web Performance TipsWeb Performance Tips
Web Performance Tips
 
6867389.ppt
6867389.ppt6867389.ppt
6867389.ppt
 
6867389.ppt
6867389.ppt6867389.ppt
6867389.ppt
 
6867389 (1).ppt
6867389 (1).ppt6867389 (1).ppt
6867389 (1).ppt
 
Learn html elements and structure cheatsheet codecademy
Learn html  elements and structure cheatsheet   codecademyLearn html  elements and structure cheatsheet   codecademy
Learn html elements and structure cheatsheet codecademy
 
Javascript dom event
Javascript dom eventJavascript dom event
Javascript dom event
 
Document object model
Document object modelDocument object model
Document object model
 
React Under the Hood: Understanding React’s UI Rendering Process
React Under the Hood: Understanding React’s UI Rendering ProcessReact Under the Hood: Understanding React’s UI Rendering Process
React Under the Hood: Understanding React’s UI Rendering Process
 
Java script
Java scriptJava script
Java script
 
DOM Quick Overview
DOM Quick OverviewDOM Quick Overview
DOM Quick Overview
 
I have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdfI have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdf
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
J Query Public
J Query PublicJ Query Public
J Query Public
 
Dom structure
Dom structure Dom structure
Dom structure
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponents
 
03DOM.ppt
03DOM.ppt03DOM.ppt
03DOM.ppt
 
J query1
J query1J query1
J query1
 

Recently uploaded

Automotive Bootloader Complete Guide with UDS Frame Format
Automotive Bootloader Complete Guide with UDS Frame FormatAutomotive Bootloader Complete Guide with UDS Frame Format
Automotive Bootloader Complete Guide with UDS Frame FormatKapil Thakar
 
Introduction to Automotive Bootloader | Programming Sequence
Introduction to Automotive Bootloader | Programming SequenceIntroduction to Automotive Bootloader | Programming Sequence
Introduction to Automotive Bootloader | Programming SequenceKapil Thakar
 
technical report on EV. EVs can offer benefitssuch as lower operating costs a...
technical report on EV. EVs can offer benefitssuch as lower operating costs a...technical report on EV. EVs can offer benefitssuch as lower operating costs a...
technical report on EV. EVs can offer benefitssuch as lower operating costs a...Bijay Sharma
 
Catalogue Yamaha Nouvo 115 S / Nouvo .pdf
Catalogue Yamaha Nouvo 115 S / Nouvo .pdfCatalogue Yamaha Nouvo 115 S / Nouvo .pdf
Catalogue Yamaha Nouvo 115 S / Nouvo .pdfHafizLaziz
 
CAMIONES TOYOTA N04C- Engine y HINO 300.
CAMIONES TOYOTA N04C- Engine y HINO 300.CAMIONES TOYOTA N04C- Engine y HINO 300.
CAMIONES TOYOTA N04C- Engine y HINO 300.JavierAlejandroCordo1
 
Quicker and better: South Korea’s new high-speed train 'EMU-320'
Quicker and better: South Korea’s new high-speed train 'EMU-320'Quicker and better: South Korea’s new high-speed train 'EMU-320'
Quicker and better: South Korea’s new high-speed train 'EMU-320'Hyundai Motor Group
 
Battery Management System Circuit Diagram.pdf
Battery Management System Circuit Diagram.pdfBattery Management System Circuit Diagram.pdf
Battery Management System Circuit Diagram.pdfElectric Vehicle Geek
 
Toyota Yaris service manual Free.pdf Toyota Yaris Service manual
Toyota Yaris service manual Free.pdf  Toyota Yaris Service manualToyota Yaris service manual Free.pdf  Toyota Yaris Service manual
Toyota Yaris service manual Free.pdf Toyota Yaris Service manualAutocarmanuals.com
 
Introduction to UDS over CAN | UDS Service
Introduction to UDS over CAN | UDS ServiceIntroduction to UDS over CAN | UDS Service
Introduction to UDS over CAN | UDS ServiceKapil Thakar
 
What Should BMW Owners Know About Steptronic Transmission Problems
What Should BMW Owners Know About Steptronic Transmission ProblemsWhat Should BMW Owners Know About Steptronic Transmission Problems
What Should BMW Owners Know About Steptronic Transmission ProblemsSchearer's Sales & Service Inc
 
-VDA-Special-Characteristics Special characteristics.pdf
-VDA-Special-Characteristics Special characteristics.pdf-VDA-Special-Characteristics Special characteristics.pdf
-VDA-Special-Characteristics Special characteristics.pdfBorja ARRIZABALAGA URIARTE
 
Car Audio Systems Enhancing Your Driving Experience
Car Audio Systems Enhancing Your Driving ExperienceCar Audio Systems Enhancing Your Driving Experience
Car Audio Systems Enhancing Your Driving ExperienceAuto Sparky
 
Timer Handling in UDS | S3 Server Timer | P2 and P2 Start Timer
Timer Handling in UDS | S3 Server Timer | P2 and P2 Start TimerTimer Handling in UDS | S3 Server Timer | P2 and P2 Start Timer
Timer Handling in UDS | S3 Server Timer | P2 and P2 Start TimerKapil Thakar
 
Why Won't Your Audi A3 Shift Into Reverse Gear Let's Investigate
Why Won't Your Audi A3 Shift Into Reverse Gear Let's InvestigateWhy Won't Your Audi A3 Shift Into Reverse Gear Let's Investigate
Why Won't Your Audi A3 Shift Into Reverse Gear Let's InvestigateAutowerks
 
Car Seat Covers and Seat Protection Guide
Car Seat Covers and Seat Protection GuideCar Seat Covers and Seat Protection Guide
Car Seat Covers and Seat Protection GuideAskXX.com
 
Battery Management System Functions (Flowchart of BMS Operations)
Battery Management System Functions (Flowchart of BMS Operations)Battery Management System Functions (Flowchart of BMS Operations)
Battery Management System Functions (Flowchart of BMS Operations)Electric Vehicle Geek
 
Is Your Porsche Cayenne Radio On The Fritz Here's What It Could Mean
Is Your Porsche Cayenne Radio On The Fritz Here's What It Could MeanIs Your Porsche Cayenne Radio On The Fritz Here's What It Could Mean
Is Your Porsche Cayenne Radio On The Fritz Here's What It Could MeanHuron Automotive
 
Vina Score and Vin Min for almost all the models 2024
Vina Score and Vin Min for almost all the models 2024Vina Score and Vin Min for almost all the models 2024
Vina Score and Vin Min for almost all the models 2024jipohal318
 
Nokia Drone Networks - Customer Presentation - MWC2.pdf
Nokia Drone Networks - Customer Presentation - MWC2.pdfNokia Drone Networks - Customer Presentation - MWC2.pdf
Nokia Drone Networks - Customer Presentation - MWC2.pdfJosFerro15
 
Solar Photovoltaic Plant Project Proposal by Slidesgo.pptx
Solar Photovoltaic Plant Project Proposal by Slidesgo.pptxSolar Photovoltaic Plant Project Proposal by Slidesgo.pptx
Solar Photovoltaic Plant Project Proposal by Slidesgo.pptxAmarHaddad
 

Recently uploaded (20)

Automotive Bootloader Complete Guide with UDS Frame Format
Automotive Bootloader Complete Guide with UDS Frame FormatAutomotive Bootloader Complete Guide with UDS Frame Format
Automotive Bootloader Complete Guide with UDS Frame Format
 
Introduction to Automotive Bootloader | Programming Sequence
Introduction to Automotive Bootloader | Programming SequenceIntroduction to Automotive Bootloader | Programming Sequence
Introduction to Automotive Bootloader | Programming Sequence
 
technical report on EV. EVs can offer benefitssuch as lower operating costs a...
technical report on EV. EVs can offer benefitssuch as lower operating costs a...technical report on EV. EVs can offer benefitssuch as lower operating costs a...
technical report on EV. EVs can offer benefitssuch as lower operating costs a...
 
Catalogue Yamaha Nouvo 115 S / Nouvo .pdf
Catalogue Yamaha Nouvo 115 S / Nouvo .pdfCatalogue Yamaha Nouvo 115 S / Nouvo .pdf
Catalogue Yamaha Nouvo 115 S / Nouvo .pdf
 
CAMIONES TOYOTA N04C- Engine y HINO 300.
CAMIONES TOYOTA N04C- Engine y HINO 300.CAMIONES TOYOTA N04C- Engine y HINO 300.
CAMIONES TOYOTA N04C- Engine y HINO 300.
 
Quicker and better: South Korea’s new high-speed train 'EMU-320'
Quicker and better: South Korea’s new high-speed train 'EMU-320'Quicker and better: South Korea’s new high-speed train 'EMU-320'
Quicker and better: South Korea’s new high-speed train 'EMU-320'
 
Battery Management System Circuit Diagram.pdf
Battery Management System Circuit Diagram.pdfBattery Management System Circuit Diagram.pdf
Battery Management System Circuit Diagram.pdf
 
Toyota Yaris service manual Free.pdf Toyota Yaris Service manual
Toyota Yaris service manual Free.pdf  Toyota Yaris Service manualToyota Yaris service manual Free.pdf  Toyota Yaris Service manual
Toyota Yaris service manual Free.pdf Toyota Yaris Service manual
 
Introduction to UDS over CAN | UDS Service
Introduction to UDS over CAN | UDS ServiceIntroduction to UDS over CAN | UDS Service
Introduction to UDS over CAN | UDS Service
 
What Should BMW Owners Know About Steptronic Transmission Problems
What Should BMW Owners Know About Steptronic Transmission ProblemsWhat Should BMW Owners Know About Steptronic Transmission Problems
What Should BMW Owners Know About Steptronic Transmission Problems
 
-VDA-Special-Characteristics Special characteristics.pdf
-VDA-Special-Characteristics Special characteristics.pdf-VDA-Special-Characteristics Special characteristics.pdf
-VDA-Special-Characteristics Special characteristics.pdf
 
Car Audio Systems Enhancing Your Driving Experience
Car Audio Systems Enhancing Your Driving ExperienceCar Audio Systems Enhancing Your Driving Experience
Car Audio Systems Enhancing Your Driving Experience
 
Timer Handling in UDS | S3 Server Timer | P2 and P2 Start Timer
Timer Handling in UDS | S3 Server Timer | P2 and P2 Start TimerTimer Handling in UDS | S3 Server Timer | P2 and P2 Start Timer
Timer Handling in UDS | S3 Server Timer | P2 and P2 Start Timer
 
Why Won't Your Audi A3 Shift Into Reverse Gear Let's Investigate
Why Won't Your Audi A3 Shift Into Reverse Gear Let's InvestigateWhy Won't Your Audi A3 Shift Into Reverse Gear Let's Investigate
Why Won't Your Audi A3 Shift Into Reverse Gear Let's Investigate
 
Car Seat Covers and Seat Protection Guide
Car Seat Covers and Seat Protection GuideCar Seat Covers and Seat Protection Guide
Car Seat Covers and Seat Protection Guide
 
Battery Management System Functions (Flowchart of BMS Operations)
Battery Management System Functions (Flowchart of BMS Operations)Battery Management System Functions (Flowchart of BMS Operations)
Battery Management System Functions (Flowchart of BMS Operations)
 
Is Your Porsche Cayenne Radio On The Fritz Here's What It Could Mean
Is Your Porsche Cayenne Radio On The Fritz Here's What It Could MeanIs Your Porsche Cayenne Radio On The Fritz Here's What It Could Mean
Is Your Porsche Cayenne Radio On The Fritz Here's What It Could Mean
 
Vina Score and Vin Min for almost all the models 2024
Vina Score and Vin Min for almost all the models 2024Vina Score and Vin Min for almost all the models 2024
Vina Score and Vin Min for almost all the models 2024
 
Nokia Drone Networks - Customer Presentation - MWC2.pdf
Nokia Drone Networks - Customer Presentation - MWC2.pdfNokia Drone Networks - Customer Presentation - MWC2.pdf
Nokia Drone Networks - Customer Presentation - MWC2.pdf
 
Solar Photovoltaic Plant Project Proposal by Slidesgo.pptx
Solar Photovoltaic Plant Project Proposal by Slidesgo.pptxSolar Photovoltaic Plant Project Proposal by Slidesgo.pptx
Solar Photovoltaic Plant Project Proposal by Slidesgo.pptx
 

Java Script and HTML.

  • 1. SLICING AND PLAYING WITH HTML Learning Java Script Editing
  • 2. What is it?  Slicing HTML involves playing with the stuff on the HTML Page like “divs”, “select boxes”, “input boxes” and much-much more
  • 3. Some key points  Every element is associated with the ID. ID is used to access that object on the HTML page. And document.getElementById(“element_name”) will give you the power to access that element on the page. Now you are just one step away from altering/modifying the HTML page.
  • 4. Key Points Cont…  document.getElementByTagsName(“div”) will give you all the divs on the page. Again one step away from editing the page. Isnt is simple?
  • 5. Key Points Cont…  Inner HTML can be used to set the content of the page. The good/bad thing about Inner html is that it over writes what ever content is already associated with that element. Inner HTML replaces (over rides) already existing conetnt.
  • 6. Document Object Model <html> <head></head> <body> <p id=”story”> Hey <strong>Akshat</strong> </p> </body> </html>
  • 7. Main Properties to consider in the Dom tree  nodeValue  nodeType  firstChild  lastChild  childNodes
  • 8. What this refers to in the HTML  Document.getElementByTagsName(“body”)[0].child Nodes[1].lastChild.  Answer :- strong.  Refer slide number 6 for HTML
  • 9. Changing the node text var node = document.getElementBId(“story”); while(node.firstchild) node.removechild(node.firstchild); node.appendchild(document.createTextNode(“OK Finally”));
  • 10. Creating a new Element var paragraph =document.createElement(p) – Just specify the tag name here paragraph.appendchild(document.createTextNode(“T he text in the paragraph”)); document.getElementbyId(“story”).appendchild(parag raph);