0
Get Input from Java Scrip and Add it to my HTML page!
Hi ! A Noob here... I am trying use Prompt to get the page viewer’s name and add it to the return alert and also to my HTML page! I have tried using write.document.innerhtml but can’t seem to get it work. Any Help is appreciated! 😊
3 ответов
+ 4
<!DOCTYPE html>
<html>
<head>
<title>Sample Page</title>
</head>
<body>
Hello there <span id="username"></span>
<script>
var username = document.getElementById("username");
var user = prompt("Enter your name:");
alert("Welcome " + user);
username.innerHTML = user;
</script>
</body>
</html>
+ 1
Thanks Ipang ! It worked like charm 😊
0
You're welcome Avtar_Singh : )