Posts

How to change Changing HTML Style (CSS) in javascript #2

avatar of @razaoktafian
25
@razaoktafian
·
0 views
·
2 min read

Hi my friends at hive, on this occasion I will share the source code for changing HTML style elements or attributes using javascript with two different functions, I just give the source code steps below:

1.As usual we will do the first step where we have to make a title in the header first so that if people read it they can find out what the program we created from javascript for writing source code can be seen in the image above.

2.In this second step I will add a button attribute so that the element that we will use and insert an image on the attribute can work, where the source code can be seen in the image above and don't forget to add text in the button attribute.

3.in this third step I will add an image whose function is for the prefix image when we press the "Turn On The Light" button where you can see the source code in the image above.

4.in this last step I will add the source code for the lights that will turn off which here we are the same as in the second step only in this fourth step it just changes the same image but with the image of the lights off so when we press "turn off light".


To see the final result in the source code, see below:

In the picture above is the result of the source code that we made earlier and all the attributes and elements are all functioning perfectly if you want to try the source code, you can directly see in the image above.

Hopefully with this article of mine to learn the Javascript programming language it can be useful and useful for you and here I am also still learning to program the JavaScript language, if you have any questions about this article, you can directly ask in the comments column and if you have ideas for me to make others can directly provide in the comments column yes.

See you again in the next article