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...
Create 1 HTML page and 1 CSS file for all the styles. Your html page will...
Create 1 HTML page and 1 CSS file for all the styles. Your html page will be a small gallery of images using the Polaroid style. The page should have at least 1 row of 3 images. You can choose any theme of images. Don't pick random images, make them all have a theme. Add an h1 tag for the header of your page. Style the h1 tag with a color, size, and font family. Include a paragraph tag under...
Create a HTML file that prompts the user to enter the number of dice (1-5) to...
Create a HTML file that prompts the user to enter the number of dice (1-5) to play with and display exactly as shown below (example run on Chrome). If the user enters a number less than 1, then set the number to 1. If the user enters a number greater than 5, then set it to 5. Center align elements and use height:200px for dice images. rollDice.html:   When user enters a number less than 1 When user enters a number...
using text edit html Create a Web page that makes a list of your favorite movies...
using text edit html Create a Web page that makes a list of your favorite movies and a list of your favorite actors. Make one list ordered (numbered) and one list unordered (bulleted). Title your Web page - John Doe's Movies Page but use your own name (this information goes in the title tag). Also include a paragraph describing one of your favorite movies and another paragraph describing one of your favorite actors. Include two heading levels - h1 and...
<HTML JAVASCRIPT> Please create an array of student names and another array of student grades. Create...
<HTML JAVASCRIPT> Please create an array of student names and another array of student grades. Create a function that can put a name and a grade to the arrays. Keep Read student name and grade until student name is “???”. And save the reading by using a function Create another function to show all the grade in that object. Create the third function that can display the maximum grade and the student’s name. Create a sorting function that can sort...
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...
5 html files minimum (does not include css file) Use of all three methods of css...
5 html files minimum (does not include css file) Use of all three methods of css (inline, internal, external). Have inline and internal css on all 5 html files and use one external css file that styles all 5 html pages Use div tags to section off part of the pages and add border radius the divs 1 paragraph on at least 5 html pages (1 paragraph must have at least 6 sentences) The following CSS properties must be used...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT