Welcome to dyslexia in dyslexia learn about DRM which is Document Object Model with the estimable DRM
JavaScript can assess and sends all elements of this damn documents.
So what happens is when the webpage is loaded anyway is the browser creates or Document Object Model
up that pays in the form of the street so you can see any of the webpage has all of these elements.
It can have estimable tag head title and any of the element which is estimable element.
So based on that tree we can make use of this element and since that element of the estimable document
with the help of its allies script.
So let's take a quick example you can simply see over here that is a tree is created by the browser
in the form of document which is object a model of any bids.
So it will just take a quick example and you will see how JavaScript can be used to tens or less stable
elements of the page to tens or less dim all attributes of the page.
It can also since all the year is this does it can remove existing estimate elements like S1 one tag
over here takes to paragraph and it can react to all the existing as dermal elements event in the page
and JavaScript can also be used to create new estimable elements in the base like we can replace the
event which is existing event to the new event with the help of a javascript.
So let's take this Dom in action.
So first of all I have the simple template over here.
That is the earliest demo tag and simply the body and the button saying click me.
So let me save this on in the browser and let me just surface this.
Then you could see it has sown Oz.
That is the button over here when it breaks.
Nothing is happening over here because we are not doing anything with this element which is the button
element of the estimate.
So let's try something different over here by making our own script in the javascript.
So let me just put this right side over here.
So after the button I want to create this script.
So zombie script will always just start with the script that is.
And now we have him that is type Zavos script let me just say remove this or simply put that here because
it is the symbol that is the attribute saying what is the type of this script.
So after this script.
Will this make use of a document object.
So I'll just say document which is referring to this got into APIs and I want to get the element of
these got into APIs so you can see will have many of the elements but in this case we want to grab this
support and which have the idea.
So we want to grab this element by the idea that means we have the get element by idea method which
is this method of JavaScript or basically Dom and it will just take that easy your idea.
So in this case I have my button which is referring to this button idea.
So let me just make this bigger so you can see we have just grab the idea which is the Burton idea.
So we want to do something with this button so I'll just add some event listener.
So if we just recall we did something like this in the case of a stimulus Living's event.
In the case of the event we make use of or on click on mouse over and all of those events do things.
The element of this day and we without doing the same with the gears of the Dom.
Will this add another that is method over here which is add event listener method.
So what this does is it to the stick to argument over here.
So in this case we have a clique argument.
So Gleick is basically doing same is on click.
So when the user presses that button we want to call these funds and this is then only most funds and
that means it doesn't have any name so it will be recalled or it will be invoke automatically.
So we want to do something over here.
So let me disclose this at event list No we're here with this semicolon.
So we want to do something with this button.
So when user presses that button we want to give the alert which is a dialog box and we'll say you have
read Dom events.
So in this to do this.
Let me just put a semicolon at the end of here.
So what we did here was we just take the event which is the idea of the button which is basically the
button stem elements with this method and we add the event which is click event to this button.
And when the user presses that button this function will be automatically invoked.
So what we did here was this funds and has been called automatically it do not need to be rebook with
his name because this is the funds and that doesn't have any name because this is the anonymous function
and we make use of this once then to give the alert to these users.
So you can do anything over here inside of these and only most funds and so let me just say this and
let me just on over here.
Let me run with this into then you can see simply a click me let me just click here and it is not happening
anything.
Let me just go back and see what is happening over here so let us see if it is this simple small click.
Let me just go back and let me this press this again and you can see here we get this.
You have free dom events.
So that means you have the alert which is the matter which is responsible to create this alert was in
book automatically when the user presses these click to that event.
You can also give an order on mouse over which is basically the an orderly snow robot here so you can
just save this town go back to Mozilla.
And when it does do something like on more sober so on most of what is not valid it must be something
like mouse over maybe mouse over is the one.
Let me just go over here.
So I think this on was only for the event if I just saved this dome it must work.
Let me just go here.
Let me just rephrase and when I this is when I just hope with the mouse to this button it will just
get you have read Dom event which is the method over here which is going to give us alert so you can
Justin's this event over here.
Let me say a mouse out which is and not even to which was responsible the way I knew this game the mounds
of or basically wherever you want.
But beyond that the events are basically the button so you can see we make use of a dom over here which
was the document object model and it has the method over here.
Taking this I.D. And we want to add some even to that I.D. or basically to that estimable element and
that was that even the listener on this case we want to make use of this event and we want to call these
funds a number that's always good which is going to do some event for us.
So this can be pretty handy when uses can't for they access this attack or the basically any type of
attack where the odds are basically businessmen civil to so some of the evenings or some of the changes
in the estimable elements based on that we can just predict this payload can be better than any other.
So basically it will have some intuition that this will be better because we'll just see what the event
was responsible for sending those demo elements that means we can just make this spill order the simple
payload for the stimulus injection and we can see the axis this attack or the vulnerabilities in the
Web site with this attack or with these events too.
So we'll just see some of the attacks are making the payloads in the upcoming lecture with the dome
See you in the next one.