Hi everyone,
I am working on a program that will allow a user to enter some customer information including name/acct number, call back number, and reason for call back, and time of call back. What I want this to do is then display the customer info (up to five customers at once) on a page. But I want a Javascript alert message to popup when the time of call back the user entered matches the correct time. What I can't think of is how I will have it check for the time (i.e. a while loop?) and I am wondering if anyone knows if this will use too much of the resources and slow up the computer. Thanks in advance.
Nick

Recommended Answers

All 3 Replies

Research JavaScript's "setTimeout" method. It calls a function you specify at specific time intervals. Presumably that function, which you'll need to write, will check through an array of "messages" to see if any are due.

After much tinkering with it, I got it to work! I don't know why I was having so much trouble with it. Thank you.
Nick

Hi everyone,
I used the setTimeout() function and got that working perfectly, thank you. But the problem I am having with it is that It doesn't call my function until the time has been met, if I change anything in the fields of the form, when the timer ends, it will display the changed material. Is there some kind of an object I can make that would keep track of up to 5 different reminders? I was thinking of like a queue object, but I'm not sure how(if I even can) implement it in javascript. Any ideas? Thank you for your help in advance. The .html page I have created is attached below. Thank you.
Nick

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>eNotes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/javascript">
<!--
// eNotes. Created by Nicholas 'Joe' Nisi. 2005
// postNote() timeIt()
		  function displayAlert()
		  {
		    var name = document.notepad.acct.value;
		    var num = document.notepad.number.value;
		    var time = document.notepad.time.value;
		    var rsn = document.notepad.reason.value;
			var i=0;

		   alert("Call " + name + " back at " + num + " for " + rsn)
		    
		  }
		  
		  function convertTime(time)
		  {
		    return time*60000;
		  }
		  
		  function printTime()
		  {
		    
		  }
-->
</script>

</head>

<body>
<table width="350" border="2" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr> 
    <td><table width="376" cellspacing="1" cellpadding="1">
        <tr>
          <td><div align="center"><strong>Cox Reminders</strong></div>
		  <br>

		  

		  </td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><form name="notepad">
	Name/Account Number:
	<input type="text" name="acct" maxlength="30">
	<p>
	Call Back Number:
	<input type="text" name="number" maxlength="10">
	<p>
	Call back in:
	<input type="text" name="time" size="4"> minute(s)
	</p>
	<p>
	Reason for Call Back:
	<input type="text" name="reason">
	</p>
	</p>
	<input type="button" onclick="setTimeout('displayAlert()', convertTime(document.notepad.time.value))" value="Submit">
 <input type="reset">
	</form>&nbsp;</td>
  </tr>
</table>
</body>
</html>
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.