I need to write an HTML page that uses an input text box to ask the viewer for a phrase. The page should also contain a button. When the button is pressed, the page should display the input phrase 10 times. The HTML page should use a JavaScript function to write out the phrase. (So if the user enters "Hello World", the page should display "Hello World" 10 times.)
How to create a textbox button that will repeat contents of textbox?
Collapse
X
-
Employing various forms of while loops but with little success. Its an assignment for a computer class I have to take in college and I basically havent grasped anything in the course so farComment
-
<html>
<head><h1>HW 11 part 2</h1></head>
<body>
<h2>Write Phrase Here:</h2><br>
<script language="Javas cript">
loop = <input type='text' id='text1' value=''>;
while (repcount = 10);
{
document.write( "text1”);
}
<script language="Javas cript">
<input type="button" value="click here"
onClick="text1 = document.getEle mentById('text1 ').value;
</body>
</script>
</body>
</html>Comment
-
The code is a mess. Here's a link to a tutorial that will give you the basics of javascript. http://www.w3schools.com/js/js_intro.aspComment
Comment