Question

In: Computer Science

Write, test, and debug (if necessary) JavaScript scripts for the following problem. You must write the...

Write, test, and debug (if necessary) JavaScript scripts for the following problem. You must write the HTML file that references the JavaScript file.

Use prompt to collect names of persons from the user. When the user enters ‘DONE’, your script should stop collecting more names. Then, it should ask the user to specify the following style properties:

Border size? 2px, 5px, or 8px.

Border Color? blue, red, green, and black.

Border style? solid, dotted, dashed, and double.


The HTML document should display the person names in a table using the style properties specified by the user.

Solutions

Expert Solution

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Portfolio</title>
    <!-- <link rel="stylesheet" href="index.css"> -->
</head>
<body>
    <div>
        <ul id="list"></ul>
    </div>
    <script src="index.js"></script>
</body>
</html>
window.addEventListener("load",myFun);
let i
let count=0

function myFun(){
    count+=1   
     if(count==1){    //to take inputs only one time
      do{
        i=prompt("enter name")
        if(i!=='DONE'){
            listItem = document.createElement('li')
            listItem.innerHTML = i
            document.getElementById("list").append(listItem)
        }
      }while(i!=="DONE")
    }
}

let borderSize=prompt("enter border in px")
let borderColor=prompt("enter border color")
let borderStyle=prompt("enter border style")

document.getElementById('list').style.borderWidth=borderSize 
document.getElementById('list').style.borderStyle=borderStyle
document.getElementById('list').style.borderColor=borderColor


Related Solutions

In this exercise, you will test and debug a Future Value Program. The pseudocode of the...
In this exercise, you will test and debug a Future Value Program. The pseudocode of the program is as follows: Display user message WHILE user wants to continue           get monthly investment, yearly interest rate, and years           convert yearly interest rate to monthly interest rate           convert years to months           set the future value to zero           FOR each month                     add monthly investment amount to future value                     calculate interest for month                     add interest to future value          ...
For this problem, you must use Excel to perform the necessary calculations. Below are the formulas...
For this problem, you must use Excel to perform the necessary calculations. Below are the formulas and equations you will need to use. Click on the image below to download a power point version if the text is blurry or too small. If it is appropirate to use the binomial distribution, use the formula=binom.dist(number_s,trails,probability,cumulative) to calculate the probability. In this formula, number_s is the number of successful trails, trails is the total number of trails, probability is the probability for...
Write MATLAB scripts to solve problem 5.21 from the textbook (bisection, specific heat) four times: a)...
Write MATLAB scripts to solve problem 5.21 from the textbook (bisection, specific heat) four times: a) with the bisection method (starting interval [0, 1200]) b) with the false-position method (starting interval [0, 1200]) c) with the Newton-Raphson method (x0 = 0) d) with the secant method ((x0, x1) = (0, 1)) use percent relative error = 10^-6 as stopping criterion. 5.21-Mechanical engineers, as well as most other engineers, use thermodynamics extensively in their work. The following polynomial can be used...
Using JavaScript You must submit a file, called indentation.js indentation.js: program to indent The following program...
Using JavaScript You must submit a file, called indentation.js indentation.js: program to indent The following program is difficult to follow because of its indentation: print ( "binary"); var n = Math.pow (2, 31) - 1; var bits = 0; while (n> 0) { bits + = n & 1; n >> = 1; } print ("Number of bits at 1:" + bits); for (var i = 1; i <= bits; i ++) { var str = ""; if (i% 3...
3. Solve the following linear programming problem. You must use the dual. First write down the...
3. Solve the following linear programming problem. You must use the dual. First write down the dual maximization LP problem, solve that, then state the solution to the original minimization problem. (a) Minimize w = 4y1 + 5y2 + 7y3 Subject to: y1 + y2 + y3 ≥ 18 2y1 + y2 + 2y3 ≥ 20 y1 + 2y2 + 3y3 ≥ 25 y1, y2, y3 ≥ 0 (b) Making use of shadow costs, if the 2nd original constraint changed...
Solve the following linear programming problem. You must use the dual. First write down the dual...
Solve the following linear programming problem. You must use the dual. First write down the dual maximization LP problem, solve that, then state the solution to the original minimization problem. (a) Minimize w = 4y1 + 5y2 + 7y3 Subject to: y1 + y2 + y3 ≥ 18 2y1 + y2 + 2y3 ≥ 20 y1 + 2y2 + 3y3 ≥ 25 y1, y2, y3 ≥ 0 (b) Making use of shadow costs, if the 2nd original constraint changed to...
Using Javascript, complete the following /************************************************************************** * * Array callback filtering * **************************************************************************/ /** * Write...
Using Javascript, complete the following /************************************************************************** * * Array callback filtering * **************************************************************************/ /** * Write and export a function named "everyEven" which takes an array and a test * function for checking individual elements of the array. The "everyEven" * function should test the even elements of the array and return true only * if at least one of the even elements passes the test. * * @param arr An array whose even elements should be tested * @param...
B. Manually analyze and debug the following logic and programming code. Write in the result column,...
B. Manually analyze and debug the following logic and programming code. Write in the result column, the value of the result variable when the variables i and j have the values ​​indicated in each row of the table (6 pts.). In the event that the result cannot be calculated, state it and the reason. Option Explicit Sub Calc () Dim i As Integer, j As Integer, n As Integer Dim result As Integer i = 0 j = 0 n...
Please write shell scripts in Kali Linux to complete the following tasks. Task A - Take...
Please write shell scripts in Kali Linux to complete the following tasks. Task A - Take your UIN Write a script like below that reads and displays the MIDAS ID if the following requirements are satisfied: Only lower case letter [a-z] and numeric character[0-9] are allowed MIDAS ID must between 4 to 8 digits Test your script with the following examples: Your MIDAS ID in lower case Your MIDAS ID w.one upper case A string less than 4 digits A...
Write a hypothesis test problem using the problem below. You believe that the population mean number...
Write a hypothesis test problem using the problem below. You believe that the population mean number of times that adults go to the gym each week is less than 2.5. You spoke with 10 people and found that they went to the gym 2, 3, 5, 3, 0, 1, 7, 3, 0, and 3 times last week. You then would choose to test this hypothesis at the .05 significance level. Assume a random sample.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT