Hello Everybody

I am developing a small project on word game. My requirement is that I have to show time out say of 25 secs on JSP page.

Code which I am using is

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">

var timer = null

Function start(){
	var time = new Date()
    var hours = time.getHours()
    var minutes = time.getMinutes()
    minutes=((minutes < 10) ? "0" : "") + minutes
    var seconds = time.getSeconds()
    seconds=((seconds < 10) ? "0" : "") + seconds
    var clock = hours + ":" + minutes + ":" + seconds
    document.forms[0].display.value = clock
	 timer = setTimeout("start()",25000)
}


</script>

</head>
<body onload="startup()">
<form action="SecondServlet">
<table BORDER=0 CELLSPACING=23 CELLPADDING=0>

	<tr>
		<td><b> WORD <input type="text" name="word"> </input> </b></td>
	</tr>


	<tr>
		<td vertical align=right><b> Ans <input type="text"
			name="yourAns"> </b></td>
	</tr>


	<tr>
		<td vertical align=center><b> SUBMIT <input type="submit"
			name="submit" value="Submit"> </input></b></td>
	</tr>







</table>
</form>

</body>
</html>

Help in any form will be appreciated.
Thanks.

Recommended Answers

All 5 Replies

Gootle HTML refresh

Gootle HTML refresh

Thanks

Actually I need to show a timer on the jsp page say of 25 sec, which indicate that user has just 25 sec to answer the question.

Then this is a JavaScript question. A function and a Div, not hard.

Moving to JavaScript forum.

Use setTimeout() in JavaScript to display the time. You could simple search for a sample on how to do setTimeout() on the Internet.

Use setTimeout() in JavaScript to display the time. You could simple search for a sample on how to do setTimeout() on the Internet.

THANKS:icon_smile:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.