I think i need to call the functon before the page fully loads can someone tell me how to do this or how to fix my problem thanks..
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <SCRIPT LANGUAGE="JavaScript">
- function getName() {
- var name = prompt("What is your name?", "")
- }
- document.write("Hello " + name + " welcome to my site");
- </SCRIPT>
- </head>
- <body>
- <BODY onLoad="getName()">
- <SCRIPT LANGUAGE="JavaScript">
- document.write("Hello " + name + " welcome to my site");
- </SCRIPT>
- </body>
- </html>