Page Timiing Demo

This demo illustrates how you can determine how long a user is taking to fill out a form on your Web page.


Please tell us a bit about yourself!

Name:
Age:


Source Code:
<% If Len(Request("btnSubmit")) > 0 then
	' the user has already filled out the form
	' How much time did they spend on the page? 
	Dim tmrTotalTimeSpent
	tmrTotalTimeSpent = DateDiff("s", Request("tmrTimeVisited"), Now()) %>
		
	Hello <%=Request("txtName")%>!  Thank you for your information.
	It took you <%=tmrTotalTimeSpent%> seconds to completely read and
	fill out the form.
<% Else %>
	<b>Please tell us a bit about yourself!</b>
	<br>
	<form method="get" action="TimingVisit.asp" id=form1 name=form1>
		<!-- hidden time counter variable -->
		<input type="hidden" name="tmrTimeVisited" value="<%=Now()%>">
			
		<b>Name:</b> <input type="text" name="txtName"><br>
		<b>Age:</b> <input type="text" size="3" name="txtAge">
		<p>
		<input type="submit" name="btnSubmit" value="Send Info">
	</form>
<% End IF %>	
	


[Return to the article]