Question

How to write a Javascript application using code below that reads names separated by spaces and...

How to write a Javascript application using code below that reads names separated by spaces and for output lists the names with the first letter of every name converted to uppercase and the rest to lower case making sure to sort the output list.

<!DOCTYPE>
<html>
<head>
<title>EXAM01_02</title>
<style type="text/css">
form{color:black;background-color:lightgray;border:6px solid black;border-width:4px;width:450px;margin:1px;padding:1px;}
#ans1,#ans2,#ans3,#names{background-color:white;border:4px solid black;}
input[type="button"]{color:black;background-color:red;border:4px solid black;}
input[type="text"]{margin:2px;}
div.title{color:white;background-color:black;float: left; width: 450px; text-align:center;}
</style>
</head>
<body>
   <form>
   <div class="title"><label>EXAM01_02</label></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>Enter Name List:</label></div><div style="float:left;"><input type="text" id="names" /></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>Answer:</label></div><div style="float:left;"><input type="text" id="ans1" /></div>
   <p style="clear:both;" />
   <div style="text-align:center;">
   <input type="button" value="Enter" />
   <input type="button" value="Clear"    />
   </div>
   </form>
</body>
</html>

Homework Answers

Answer #1

Answer:

Code:

<!DOCTYPE>
<html>
<head>
<title>EXAM01_02</title>
<style type="text/css">
form{color:black;background-color:lightgray;border:6px solid black;border-width:4px;width:450px;margin:1px;padding:1px;}
#ans1,#ans2,#ans3,#names{background-color:white;border:4px solid black;}
input[type="button"]{color:black;background-color:red;border:4px solid black;}
input[type="text"]{margin:2px;}
div.title{color:white;background-color:black;float: left; width: 450px; text-align:center;}
</style>
</head>
<body>
<form>
<div class="title"><label>EXAM01_02</label></div>
<p style="clear:both;" />
<div style="float:left;width:150px;"><label>Enter Name List:</label></div><div style="float:left;"><input type="text" id="names" /></div>
<p style="clear:both;" />
<div style="float:left;width:150px;"><label>Answer:</label></div><div style="float:left;"><input type="text" id="ans1" /></div>
<p style="clear:both;" />
<div style="text-align:center;">
<input type="button" value="Enter" onclick="fun();" />
<input type="button" value="Clear" />
</div>
<script type="text/javascript">
function fun()
{
var m=document.getElementById("names").value;
var result=m.toLowerCase().split(" ");
for (var i=0;i<result.length;i++)
{
result[i]=result[i].charAt(0).toUpperCase()+result[i].substring(1);
}
result.sort();
res1=result.join(" ");
document.getElementById("ans1").value=res1;

}
</script>
</form>
</body>
</html>

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Hello, I am trying to create a java script code that can arranges the input lowest,...
Hello, I am trying to create a java script code that can arranges the input lowest, highest, finding average, sort them and the clear form functionality. I managed to create the code that sorts the number input from lowest to highest but I am stuck on the rest. See the code below Please help. <!DOCTYPE> <html> <head> <title>EXAM01_01</title> <style type="text/css"> form{color:black;background-color:lightgray;border:6px solid black;border-width:4px;width:450px;margin:1px;padding:1px;} #ans1,#ans2,#ans3,#ans4,#numbers{background-color:white;border:4px solid black;} input[type="button"]{color:black;background-color:red;border:4px solid black;} input[type="text"]{margin:2px;} div.title{color:white;background-color:black;float: left; width: 450px; text-align:center;} </style> <script>    function readNumbers()...
Please linked both files. For this assignment you need to create a ToDo list using Javascript,...
Please linked both files. For this assignment you need to create a ToDo list using Javascript, along with HTML and CSS. Begin by creating a HTML page called todo.html. Then create a Javascript file called todo.js and link it in to the HTML page using a script tag. All Javascript for the assignment must be in the separate file. (For CSS, feel free to include styles in a style block at the top of the HTML page, or to link...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you will demonstrate how to create an HTML file, externally link a JavaScript file, and write some source code in the JavaScript file. a..Create two blank files to be an HTML file and a JavaScript file. The file names should be partA.html and partA.js. b.. Create a basic HTML webpage structure. c..Link the JavaScript file to the HTML file using the <script> tag. d.. Prompt...
<!doctype html> <html lang=”en”>   <head>     <title>Principal Calculation Form</title>     <meta charset="utf-8"/>         
<!doctype html> <html lang=”en”>   <head>     <title>Principal Calculation Form</title>     <meta charset="utf-8"/>                   <script src="code.js"></script>   </head>      <body onload="setFocus();">     <div class="container">                                       <div class="main">                                                                                <form action="#" method="post" name="form_name" id="form_id" class="form_class" >                                                                           <h2>--Principal Loan Form--</h2>                                                                                                                                                      <h5>Disclaimer: This software by no mean will precisely predict your mortgage through your lender company.  This Software will only assume the four items below in order to make an educated guess or prediction to your exact mortgage interests amount and the duration of your loan from your lender. <img...
I am trying to make a contact form to give input on another browser window. I...
I am trying to make a contact form to give input on another browser window. I am only getting the php code. I am trying to figure out why it won't post. Her is my html and php files: <!DOCTYPE html> <html> <head> <title>Contact</title> <link rel="stylesheet" href="main.css"> </head> <body>    <h1>Contact Form</h1> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="page2.html">My PodCast</a></li> <li><a href="page3.html">Contact Me</a></li> <li><a href="page4.html">Resources</a></li> <li><a href="addressbook.html">Address Book</a></li> <li>Contact Form</li> </ul> </nav> <center><h2>Please fill out form</h2> <div id='container'> <div id='header'></div> <center><h3>Contact</h3>...
Part 1: Create the grid tic-tac-toe gameboard using buttons and iteration. Part 2: Human user gets...
Part 1: Create the grid tic-tac-toe gameboard using buttons and iteration. Part 2: Human user gets to select an open cell on the grid - place an X on that button selected Part 3: Check for a win using DOM iteration - new game option if row or column matching X pattern Part 4: Computer gets to select an open cell on the grid - place an O on that button selected Part 5: Check for a win using DOM...
Using Notepad++, copy the code presented in Listing 26.2, "A Form That Displays Data in a...
Using Notepad++, copy the code presented in Listing 26.2, "A Form That Displays Data in a Pop-Up Window," in the subsection "Displaying Data From a Form" in the section "Accessing Form Elements With JavaScript" in Ch. 26, "Working with Web-Based Forms of Sams Teach Yourself HTML, CSS and JavaScript All In One. Save the file using the name Week4ValidationExample.html. Test your code and debug as necessary. Change the name of the display() function to myDisplay() where my is your first...
Java Script I need the code to produce these 3 output. I can only get it...
Java Script I need the code to produce these 3 output. I can only get it to produce input #3 I need it to produce the following: // Input #1: // http://www.example.com // Output // http://www.example.com // Input #2: // http://www.example.com?name=r2d2 // Output // http://www.example.com // name: r2d2 // Input #3: // http://www.example.com?name=r2d2&email=r2d2%40me.com&human=no // Output // http://www.example.com // name: r2d2 // email: [email protected] // human: no THIS IS WHAT I HAVE SO FAR: HTML <!DOCTYPE html> <html lang="en"> <head> <meta...
8- Develop a personal web page for yourself using HTML, CSS, and Javascript Use the following...
8- Develop a personal web page for yourself using HTML, CSS, and Javascript Use the following HTML tags to design your webpage <h1>…</h1> , <h3>… </h3> , <h6>… </h6> , <p>…</p> , <b> …</b> , <i>…</ i>, <a…..> </a>, <img…..> , <table>….</table> , <div> …</div>, <form>…</ form>, <input type=“text”>, and <input type=“submit”> Use an external css to change the default style of your webpage. You must use at least one element selector, one id selector, and one class selector Using...
Develop a personal web page for yourself using HTML, CSS, and Javascript Use the following HTML...
Develop a personal web page for yourself using HTML, CSS, and Javascript Use the following HTML tags to design your webpage <h1>...</h1>, <h3>...</h3>,<h6>...</h6>,<p>...</p>,<b>...</b>,<i>...</i>,<a>...</a>,<img>, <table> ... </table>, <div> ... </div>, <form> ... </form>, <input type ="text">, and <input type ="submit"> Use an external css to change the default style of your webpage. You must use at least one element selector, one id selector, and one class selector Using text input and submit button, allow the user to change the background color...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT