Question

In: Computer Science

5. Create an HTML file that uses an array to store links for your three favorite...

5. Create an HTML file that uses an array to store links for your three favorite websites. Use a for loop to display each link URL within an alert dialog box. I would like to see the HTML page displaying the message.

Solutions

Expert Solution

SOLUTION-

Below is HTML file code :

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Websites</title>
    <script>

   function display()
   {
    
      var websites= new Array();
        var i =0;
   
       websites[0]= document.getElementById("TS1").value;
        websites[1]= document.getElementById("TS2").value;
        websites[2]= document.getElementById("TS3").value;
     
     for(i =0 ;i<3;i++){

alert(" The website "+ (i+1) +" is " +websites[i]);
}
   
   }
    </script>
</head>
<body>
<table>
    <tr>
        <td>Website # 1</td>
        <td><input type="text" name="TS1" id="TS1"></td>
      
    </tr>
    <tr>
        <td>Website # 2</td>
        <td><input type="text" name="TS2" id="TS2"></td>
    </tr>
    <tr>
        <td>Website #3 </td>
        <td><input type="text" name="FS1" id="TS3"></td>
    </tr>
    <tr>
      
        <td colspan="2" align="right"><input type="submit" value="Display Website" onclick="display()"></td>
    </tr>
    </table>
</body>
</html>

Sample Output:

First Page:

   

After clicking on Display Button


IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANSWER-----------THANK YOU!!!!!!!!----------


Related Solutions

Write the code to create an array named movies and store three of your favorite movies...
Write the code to create an array named movies and store three of your favorite movies in the array. Only provide the array and code needed to put the movie names in the array. Do not include additional code
Exercise 1 (a) Create a HTML file that uses createElement and appendChild to dynamically insert three...
Exercise 1 (a) Create a HTML file that uses createElement and appendChild to dynamically insert three paragraphs when a button is clicked. (b) Create a HTML file that includes JavaScript that is similar to: let recs = [“my item …1”,”my item…2”, …] i.e. an array that contains several CSV item records. When the user clicks a button, each array element will be rendered as a list element. Use a HTML list. Use createElement and appendChild. (c) Redo your createTable code...
How to do in C++ HTML Converter Create a program that reads an HTML file and...
How to do in C++ HTML Converter Create a program that reads an HTML file and converts it to plain text. Console HTML Converter Grocery List * Eggs * Milk * Butter Specifications Your instructor should provide an HTML file named groceries.html that contains these HTML tags: <h1>Grocery List</h1> <ul>     <li>Eggs</li>     <li>Milk</li>     <li>Butter</li> </ul> When the program starts, it should read the contents of the file, remove the HTML tags, remove any spaces to the left of the tags, add...
This is C++ Create a program that reads an HTML file and converts it to plain...
This is C++ Create a program that reads an HTML file and converts it to plain text. Console: HTML Converter Grocery List * Eggs * Milk * Butter Specifications: The HTML file named groceries.html contains these HTML tags: <h1>Grocery List</h1> <ul> <li>Eggs</li> <li>Milk</li> <li>Butter</li> </ul> When the program starts, it should read the contents of the file, remove the HTML tags, remove any spaces to the left of the tags, add asterisks (*) before the list items, and display the...
a) Using vi (or from your favorite editor) create a file called myscript. Enter the following...
a) Using vi (or from your favorite editor) create a file called myscript. Enter the following text into the myscript file. #!/bin/bash echo -e "this is a sample shell script. \t It displays mounted filesystems \a" mount b) Now, save the file and quit the editor. c) type ls -l myscript and hit enter. What permissions do you have on the file? d) type bash myscript and hit enter. What did it do? e) what does the \t and \a...
c++ language Create a file program that reads an int type Array size 10; the array...
c++ language Create a file program that reads an int type Array size 10; the array has already 10 numbers, but your job is to resize the array, copy old elements of array to the new one and make it user input and add an additional 5 slots in the array, and lastly do binary search based on user input. close the file.
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
Using node.js, create the following tasks. 1. Set up a server and HTML file server as...
Using node.js, create the following tasks. 1. Set up a server and HTML file server as shown in the videos. Once you have it successfully running, make the following adjustments A. When a 404 error (file not found) occurs, display a funny message about the file missing and/or did you forget how to type? B. If the user enters a request for the home page (index.html) then: Display an index.html page you have created which includes your name, course number,...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
You are now the manager of your favorite grocery store. Your job is to improve the...
You are now the manager of your favorite grocery store. Your job is to improve the store aesthetics and products to make sure that more shoppers come in to shop. You are asked to come up with a regression analysis to answer this question: If you were to run a logistic regression analysis, what would your dependent variable be? What would the 1, 0 indicate?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT