I am working on a normal javascript program where i have to take two names and put them in array and print out in sorted order.But,when the user clicks the print button it should show the output,but if user clicks second time,it should start again(basically reload the page).I have done the part about userinput and sorting and printing,but couldn't get the function of when user clicks button second time.
<!DOCTYPE html>
<html>
<body>
<input type="text" id="Name1" value=""><br>
<input type="text" id="Name2" value=""><br>
<input type="text" id="Name3" value=""><br>
<input type="text" id="Name4" value=""><br>
<input type="text" id="Name5" value=""><br>
<input type="text" id="Name6" value=""><br>
<input type="text" id="Name7" value=""><br>
<input type="text" id="Name8" value=""><br>
<input type="text" id="Name9" value=""><br>
<input type="text" id="Name10" value=""><br>
<button onclick = "Print()">Print</button>
<div id="output"></div>
<script>
var names = [];
function Print(){
var a=document.getElementById("Name1").value;
var b= document.getElementById("Name2").value;
var c= document.getElementById("Name3").value;
var d= document.getElementById("Name4").value;
var e= document.getElementById("Name5").value;
var f= document.getElementById("Name6").value;
var g= document.getElementById("Name7").value;
var h= document.getElementById("Name8").value;
var i= document.getElementById("Name9").value;
var j= document.getElementById("Name10").value;
names.push(a);
names.push(b);
names.push(c);
names.push(d);
names.push(e);
names.push(f);
names.push(g);
names.push(h);
names.push(i);
names.push(j);
var output = document.getElementById("output");
for (var count = 0; count < names.length; count++) {
names.sort();
output.innerHTML += "<p>" + names[count] +
"</p><br>";
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<input type="text" id="Name1" value=""><br>
<input type="text" id="Name2" value=""><br>
<input type="text" id="Name3" value=""><br>
<input type="text" id="Name4" value=""><br>
<input type="text" id="Name5" value=""><br>
<input type="text" id="Name6" value=""><br>
<input type="text" id="Name7" value=""><br>
<input type="text" id="Name8" value=""><br>
<input type="text" id="Name9" value=""><br>
<input type="text" id="Name10" value=""><br>
<button onclick = "Print()">Print</button>
<div id="output"></div>
<script>
var names = [];
function Print(){
var output = document.getElementById("output");
var data=output.innerHTML;
if(data.length!=0){
location.reload();
}
var a=document.getElementById("Name1").value;
var b= document.getElementById("Name2").value;
var c= document.getElementById("Name3").value;
var d= document.getElementById("Name4").value;
var e= document.getElementById("Name5").value;
var f= document.getElementById("Name6").value;
var g= document.getElementById("Name7").value;
var h= document.getElementById("Name8").value;
var i= document.getElementById("Name9").value;
var j= document.getElementById("Name10").value;
names.push(a);
names.push(b);
names.push(c);
names.push(d);
names.push(e);
names.push(f);
names.push(g);
names.push(h);
names.push(i);
names.push(j);
// make it empty before appending everything
output.innerHTML="";
for (var count = 0; count < names.length; count++) {
names.sort();
output.innerHTML += "<p>" + names[count] +
"</p><br>";
}
}
</script>
</body>
</html>

I am working on a normal javascript program where i have to take two names and...
NEED HELP with HTML with Javascript embedding
for form validation project below. I have my code
below but I'm stuck with validation. If anyone can fix it, I'd
really appreciate.
******************************************************************************
CODE:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project
Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Nice</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<script>
var textFromTextArea;
function getWords(){
var text =...
I have some code for HTML/Javascript but I need to change it up a bit. Heres the assignment and what I have. The part in the bold is what I need help with. I need a button called new timer for when it reaches zero... Thank you. Assignment For this assignment, you will write a timer application in HTML and JavaScript. Your HTML document should contain the following elements/features: HTML tags: An <input> tag labeled "Timer Duration" with the initial...
Write a html javascript program to do the following: the user inputs a number, for example, 50 user presses a button, labeled START the program creates 50 random buttons around the browser window each button should be placed at a random location each button should be labeled with a random number between 1 and 50 add the following features every 2 seconds, move each button around by increment or decrementing its location if the user clicks on a button, change...
Modify this code to store the form elements as variables and display them on the page in an HTML table. <!DOCTYPE html> <html> <head> <script> function getValues() { var result = ""; result += "First Name: " + document.forms["myForm"]["fname"].value + "<br>"; result += "Last Name: " + document.forms["myForm"]["lname"].value + "<br>"; result += "Address: " + document.forms["myForm"]["address"].value + "<br>"; result += "City: " + document.forms["myForm"]["city"].value + "<br>"; result += "State: " + document.forms["myForm"]["state"].value + "<br>"; document.getElementById("output").innerHTML = result; } </script>...
How can I connect the html forms to php --> mysql database <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h2> <center> Average: </h2> <h3> <center> Rate the following: </h2> <h3> <center> Rating Criteria: <br> Developing (0-5), Competent (6-10), Accomplished (10-15); </h3> <center> Judge Name: <input type="text" id="judge"> <br> <br> <center> 1. Articulate requirements and design of the project: <input type="text" id="num1"> <br> <br> 2. Plan the solution and implement the project: <input type="text" id="num2"> <br> <br> 3....
I can't figure this one out at all. Any help would be appreciated. Here's the question: You will need to complete the functions to Toggle the Fries and Drinks sections by adding or removing the 'hide' CSS class I created. I have already created the function to Toggle Burgers and you can use that as an example to build out the full functionality. I have also made created the function to reset the form. Finally, to calculate the total, you...
for Javascript, JQuery
When the page is first opened a user will see the name field and the
three vacation images to the left of the page. The page
should behave according to the following rules.
1. When a user's mouse pointer goes over any image, that image's
border will change to be "outset 10px" and when the mouse pointer
leaves that image it's border will change to "none".
2. When the user clicks a "Vacation" image on the left,...
<!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 4 Hands-on Project 4-3 Author: Date: Filename: index.htm --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Hands-on Project 4-3</title> <link rel="stylesheet" href="styles.css" /> <script src="modernizr.custom.05819.js"></script> </head> <body> <header> <h1> Hands-on Project 4-3 </h1> </header> <article> <div id="results"> <p id="resultsExpl"></p> <ul> <li id="item1"></li> <li id="item2"></li> <li id="item3"></li> <li id="item4"></li> <li id="item5"></li> </ul> </div> <form> <fieldset> <label for="placeBox" id="placeLabel"> Type the name of a place, then click Submit: </label> <input type="text" id="placeBox"...
This question relates to Javascript. Could you please show me why my code is not working? I want to create 2 text boxes and have the user enter something into both of them. If the text entered into both boxes is identical the a green message is made visible. If the boxes are different a red message is made visable. Please keep it simple because I am new to javascript. <html> <head> <title></title> <script>...
This question relates to Javascript. Could you please show me why my code is not working? I want to create 2 text boxes and have the user enter something into both of them. If the text entered into both boxes is identical the a green message is made visible. If the boxes are different a red message is made visable. Please keep it simple because I am new to javascript. <html> <head> <title></title> <script>...