Now In this article, you can see the method/Display possibilities, statement, and syntax. Also, for this you may learn basic HTML so that prefer this to understand the hole HTML language, so link – https://techiebot55.blogspot.
For this simply create one html file and and for access the data for html file you may create one id like, <p id=”demo”></p> and then inside the script tag call the id attribute.
syntax is like – document.getElementById(“demo”).innerHTML=2+2;
In this method no need to create any attribute for fetch or access the data, because in this method no need to create an id or content for accessing to the data. in this automatic browser can access the which write in the document.write() box inside the script tag .
For syntax like this – document.write(2+2); .
In this method, if you can use an alert box to display data. also, you can skip this window word. It not necessary to write a word. In this window, word specifies as a keyword. This window object is a global scope object, which means by default variable, keywords, properties belong to the window object.
For this syntax is like – alert(2+2); so output given in the alert box.
In this method, you can call the window.log() method in the browser to display the data. For this it’s simply written console.log(2+2);
<html> <body> <h2>The window.print() Method</h2> <p>Click the button to print.</p> <button onclick="window.print()">Print the page</button> </body> </html>
output is like :-
Also, visit these articles:-
- How To Get Started With Python?
- How To Create A Python Snake Game Using Pygame.
- Best Free Games For PC In 2020
- How To Chrome OS Install On PC.
If you have any doubts any suggestions or any query DM us one below Social media handles.
Our Social Media Handles:-
Instagram Handle :- https://www.instagram.com/smgplaza/
Twitter Handle :- https://twitter.com/smgplaza
Thank you so much. You have to follow us using your mail id and also follow us on social media for more updates.