Basically what I have so far is a page that has two pop-up/alert boxes. The first asks the user to input the name of their favorite website. The second asks the user to input the URL to their favorite website. The outcome is supposed to display in a hyperlink on the homepage as the name the user entered that directs to the URL they entered when clicked on. Here is what my code looks like:
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<script type="text/javascript">
var favoriteSite;
favoriteSite = prompt ("What is your favorite web site?")
favoriteSite = prompt ("What is the URL of that site?")
document.write('<a href="' + favoriteSite + '"></a>')
</script>
<h1>Link to favorite site.</h1>
<h2>This is my favorite web site</h2>
</body>
</html>
PS. I am a very very beginner to JavaScript, any assistance would be appreciated. Thanks.
This is what I ended up changing to:
<html>
<head>
<title>Untitled</title>
</head>
<body>
<script type="text/javascript">
var favoriteSite;
var favoriteSiteName;
favoriteSiteName = prompt ("What is your favorite web site?");
favoriteSite = prompt ("What is the URL of that site?");
document.write("<h1>Link to favorite website.</h1>");
document.write("<h2>This is my favorite web site" +" " + favoriteSiteName.link("https://" + favoriteSite + "") + "</p>");
</script>
</body>
</html>