Hi,
I am trying to create a program in HTML using JavaScript. In which i want to take input from user in number and want to print the stars "*" of that number.
Kindly help and reply me with the accurate code.
Thanks
My Code is:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<script>
function PrintStars() {
var x = 0;
var y = 10;
for(x=0;x<10;x++)
{
for(y=0;y<=x;y=y+1)
{
document.getElementById("TableArea").innerHTML="<br>" + document.getElementById("etext").value;
document.write = "*";
}
}
}
</script>
<body>
Enter a Number: <input id="etext" type="text" placeholder="Enter a number here"/>
<p id="TableArea"></p>
<input type="button" Value="Print" onclick="PrintStars();"/>
</body>
</html>