p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Placing a function() or alert() in the program (http://p2p.wrox.com/showthread.php?t=24446)

hayley January 25th, 2005 02:12 AM

Placing a function() or alert() in the program
 
Dear all, got a favour to ask as I have problems solving the algorithm of the program.

The test page is http://n.domaindlx.com/hayley/overalljobalert.asp

I wanna do an alert() such that when the program runs, ONLY when there are overdue dates then the window alert will pop up once to warn the user to check the overdue dates.
As it is in a while loop, when there are 3 overdues, the window pops up 3 times. I can't figure out how I can solve it. Any suggestions? Please help..Thanks so much in advance!


Shibu January 25th, 2005 04:50 AM

I suppose you need to alert when the page is been loaded.
I will suggest to get the messages in a javascript array.

Such as

 <script language = "javascript">
  var arr_messages = array(1);
<%
  Dim i_count
  i_count = 1
 while not rs.eof
%>
  arr_messages.length = <%=i_count%>;
  arr_messages[<%=i_count-1%>] = " Your message";
<%
  rs.movenext
 wend
%>
</script>

After these things you can call this function from onload()

<script language = "javascript">
function func_messages()
{
   for(i=0;i< arr_messages.length;i++)
   {
      alert(arr_messages[i]);
   }
}
</script>

 You can employ any idea. This is just to explain how to interact between javascript and ASP.
 Hope it helps you.:)


Shibu Narayanan
Software Associates


All times are GMT -4. The time now is 11:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.