Consider the following HTML page:
<html><head></head>
<body>
<form id="form1" name="form1" method="post" action="">
Enter a value
<label for ="txtString"></label>
<input type="text" name="txtString" id="txtString"/>
<input type="submit" name="button" id="button" value="Submit"/>
</form></body></html>
Assume that the page accept a string .Write a JavaScript function called printString() to to display every other word in a new line.the output will be displayed as an alert.
input: Hickory dickory dock.the mouse went up the clock.
output:
Hickory
dock.
mouse
up
clock
Comments
Leave a comment