How can I make a loading page with window.onload?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make a loading page with window.onload??

19th Feb 2018, 9:42 PM
Sina
Sina - avatar
8 Answers
+ 3
<p id="del">Loading </p> <script> window.onload = function (){ document.getElementById("del").style.display ="none";} </script> note that this could not work in some browsers so you can use this: <body onload="func()"> <p id="del">Loading </p> <script> function func(){ document.getElementById("del").style.display ="none"; } </script></body>
20th Feb 2018, 5:21 PM
Dominique Abou Samah
Dominique Abou Samah - avatar
+ 2
what exactly do you want to load with the page? usually you make a function and call it in the onload event
19th Feb 2018, 10:17 PM
Dominique Abou Samah
Dominique Abou Samah - avatar
+ 1
Are yo sure that it works??
20th Feb 2018, 8:51 PM
Sina
Sina - avatar
0
No I want to make a <p> tag that it write loading.. and when the page loaded the <p> tag get's delet
20th Feb 2018, 4:56 PM
Sina
Sina - avatar
0
not sure you would be able to see it unless the page too big and very slow to load (usually its fast) but the code does what it sais
20th Feb 2018, 10:14 PM
Dominique Abou Samah
Dominique Abou Samah - avatar
0
ok
20th Feb 2018, 10:20 PM
Sina
Sina - avatar
0
Thank you so much
20th Feb 2018, 10:20 PM
Sina
Sina - avatar
0
most welcome ^^
20th Feb 2018, 10:21 PM
Dominique Abou Samah
Dominique Abou Samah - avatar