+ 19

Can we use onlaod attribute to call function that gets inputs from the user in order to use these inputs in our html page?

<html_element onload="function()"></html_element> if the answer is yes, could you give me an example, please?

26th May 2019, 10:22 AM
Nour Abu Assaf
Nour Abu Assaf - avatar
5 ответов
+ 21
Airree thanks a lot for your help
26th May 2019, 7:02 PM
Nour Abu Assaf
Nour Abu Assaf - avatar
+ 9
You can do it entirely in JS: window.onload = () => { let name = prompt("Enter your name"); document.getElementById("temp").innerHTML = `Your name is ${name}`; }
26th May 2019, 10:32 AM
Airree
Airree - avatar
28th May 2019, 8:13 AM
GeneralZod
GeneralZod - avatar
- 1
Hey is there some one who is still learning javascript
28th May 2019, 7:53 AM
Pimyamñ
Pimyamñ - avatar
- 1
Ok i get it thanks
28th May 2019, 10:40 AM
Pimyamñ
Pimyamñ - avatar