By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,981 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

Change colour of text when webpage updates

P: 8
Afternoon all,

I have a Web based Sales tracker that sales agents sumbitted information onto a web page that then goes into an Access database, using ASP Javascript and/or VBScript

I have webpages that are linked to Access queries that show the volumes of sales by agent, for example

Name Sales

Agent1 5
Agent2 3
Agent3 1

Then once the webpage is refreshed (so it re runs the query in access) it displayed this:

Name Sales

Agent1 6
Agent2 4
Agent3 1

Agent1 and Agent2 flash a different colour to show that they have added a new sale

Really hope that makes sense

Can anyone help

Massive Thanks
May 30 '12 #1
Share this Question
Share on Google+
3 Replies


CroCrew
Expert 100+
P: 563
I think we can help. But, first what code have you got for the page so that we can build off of it.

Happy Coding,
CroCrew~
Jun 26 '12 #2

P: 8
Here is a copy of the code

It's the Sales Column I want to flash a colour when it changes. Really appreciate your help

Thanks

Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="../Connections/database1.asp" -->
  3. <%
  4. Dim Totals__MMColParam
  5. Totals__MMColParam = "Steven Thomas"
  6. If (Request("MM_EmptyValue") <> "") Then 
  7.   Totals__MMColParam = Request("MM_EmptyValue")
  8. End If
  9. %>
  10. <%
  11. Dim Totals
  12. Dim Totals_cmd
  13. Dim Totals_numRows
  14.  
  15. Set Totals_cmd = Server.CreateObject ("ADODB.Command")
  16. Totals_cmd.ActiveConnection = MM_database1_STRING
  17. Totals_cmd.CommandText = "SELECT * FROM QryWallboardTeamPremiums WHERE Team = ?" 
  18. Totals_cmd.Prepared = true
  19. Totals_cmd.Parameters.Append Totals_cmd.CreateParameter("param1", 200, 1, 50, Totals__MMColParam) ' adVarChar
  20.  
  21. Set Totals = Totals_cmd.Execute
  22. Totals_numRows = 0
  23. %>
  24. <%
  25. Dim Recordset2__MMColParam
  26. Recordset2__MMColParam = "Steven Thomas"
  27. If (Request("MM_EmptyValue") <> "") Then 
  28.   Recordset2__MMColParam = Request("MM_EmptyValue")
  29. End If
  30. %>
  31. <%
  32. Dim Recordset2
  33. Dim Recordset2_cmd
  34. Dim Recordset2_numRows
  35.  
  36. Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
  37. Recordset2_cmd.ActiveConnection = MM_database1_STRING
  38. Recordset2_cmd.CommandText = "SELECT * FROM QryWallboardbyAgentPremiums5 WHERE Team = ? ORDER BY Conversion DESC" 
  39. Recordset2_cmd.Prepared = true
  40. Recordset2_cmd.Parameters.Append Recordset2_cmd.CreateParameter("param1", 200, 1, 50, Recordset2__MMColParam) ' adVarChar
  41.  
  42. Set Recordset2 = Recordset2_cmd.Execute
  43. Recordset2_numRows = 0
  44. %>
  45. <%
  46. Dim TotalCallsbyTeam__MMColParam
  47. TotalCallsbyTeam__MMColParam = "Steven Thomas"
  48. If (Request("MM_EmptyValue") <> "") Then 
  49.   TotalCallsbyTeam__MMColParam = Request("MM_EmptyValue")
  50. End If
  51. %>
  52. <%
  53. Dim TotalCallsbyTeam
  54. Dim TotalCallsbyTeam_cmd
  55. Dim TotalCallsbyTeam_numRows
  56.  
  57. Set TotalCallsbyTeam_cmd = Server.CreateObject ("ADODB.Command")
  58. TotalCallsbyTeam_cmd.ActiveConnection = MM_database1_STRING
  59. TotalCallsbyTeam_cmd.CommandText = "SELECT SumOfNumberofCalls FROM QryTotalNumberofCallsbyTeam WHERE Team = ?" 
  60. TotalCallsbyTeam_cmd.Prepared = true
  61. TotalCallsbyTeam_cmd.Parameters.Append TotalCallsbyTeam_cmd.CreateParameter("param1", 200, 1, 50, TotalCallsbyTeam__MMColParam) ' adVarChar
  62.  
  63. Set TotalCallsbyTeam = TotalCallsbyTeam_cmd.Execute
  64. TotalCallsbyTeam_numRows = 0
  65. %>
  66. <%
  67. Dim TeamConversion__MMColParam
  68. TeamConversion__MMColParam = "Steven Thomas"
  69. If (Request("MM_EmptyValue") <> "") Then 
  70.   TeamConversion__MMColParam = Request("MM_EmptyValue")
  71. End If
  72. %>
  73. <%
  74. Dim TeamConversion
  75. Dim TeamConversion_cmd
  76. Dim TeamConversion_numRows
  77.  
  78. Set TeamConversion_cmd = Server.CreateObject ("ADODB.Command")
  79. TeamConversion_cmd.ActiveConnection = MM_database1_STRING
  80. TeamConversion_cmd.CommandText = "SELECT CountOfMediaRoute FROM QryConversionInboundTeam WHERE Team = ?" 
  81. TeamConversion_cmd.Prepared = true
  82. TeamConversion_cmd.Parameters.Append TeamConversion_cmd.CreateParameter("param1", 200, 1, 50, TeamConversion__MMColParam) ' adVarChar
  83.  
  84. Set TeamConversion = TeamConversion_cmd.Execute
  85. TeamConversion_numRows = 0
  86. %>
  87. <%
  88. Dim Repeat2__numRows
  89. Dim Repeat2__index
  90.  
  91. Repeat2__numRows = -1
  92. Repeat2__index = 0
  93. Recordset2_numRows = Recordset2_numRows + Repeat2__numRows
  94. %>
  95. <%
  96. Dim Repeat1__numRows
  97. Dim Repeat1__index
  98.  
  99. Repeat1__numRows = -1
  100. Repeat1__index = 0
  101. DSSales_numRows = DSSales_numRows + Repeat1__numRows
  102. %>
  103. <% on error resume next%>
  104. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  105. <html xmlns="http://www.w3.org/1999/xhtml">
  106. <head>
  107. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  108. <title>Steven Thomas Wallboard</title>
  109. <style type="text/css">
  110. <!--
  111. .style1 {
  112.     font-size: 18px;
  113.     font-weight: bold;
  114. }
  115. .style2 {
  116.     color: #FFFFFF;
  117.     font-weight: bold;
  118. }
  119. -->
  120. </style>
  121.  
  122. <style type="text/css">
  123. <!--
  124. .style3 {
  125.     font-size: 12px;
  126.     font-weight: bold;
  127. }
  128. .style4 {font-size: 12px}
  129. .style8 {font-size: 14; font-weight: bold; }
  130. .style11 {font-size: 10px}
  131. -->
  132. </style>
  133. </head>
  134.  
  135. <body>
  136. <div align="center">
  137.   <p class="style1">Steven Thomas Wallboard </p>
  138. </div>
  139. <div align="center">
  140.   <table centre border="1">
  141.     <tr>
  142.       <td bordercolor="#FFFFFF" bgcolor="#FF0000"><div align="center" class="style2">AgentName</div></td>
  143.       <td bordercolor="#FFFFFF" bgcolor="#FF0000"><div align="center" class="style2">Calls</div></td>
  144.       <td bordercolor="#FFFFFF" bgcolor="#FF0000"><div align="center" class="style2">
  145.         <div align="center">Sales</div>
  146.       </div></td>
  147.       <td bordercolor="#FFFFFF" bgcolor="#FF0000"><div align="center" class="style2">Conversion</div></td>
  148.     </tr>
  149.     <% 
  150. While ((Repeat2__numRows <> 0) AND (NOT Recordset2.EOF)) 
  151. %>
  152.         <tr>
  153.           <td><div align="center"><span class="style3 style4"><%=(Recordset2.Fields.Item("FriendlyName").Value)%></span></div></td>
  154.           <td><div align="center">
  155.               <div align="center"><span class="style3"><%=(Recordset2.Fields.Item("Calls").Value)%></span></div></td>
  156.           <td class="style8"><div align="center"><span class="style3"><%=(Recordset2.Fields.Item("Sales").Value)%></span></div></td>
  157.           <td class="style8">
  158.           <div align="center">
  159.           <div align="center"><%= FormatPercent((Recordset2.Fields.Item("Conversion").Value), 2, -2, -2, -2) %></div></td>
  160.         </tr>
  161. <% 
  162.   Repeat2__index=Repeat2__index+1
  163.   Repeat2__numRows=Repeat2__numRows-1
  164.   Recordset2.MoveNext()
  165. Wend
  166. %>
  167. <tr>
  168.         <td height="23"><div align="center" class="style3">
  169.           <div align="center">Totals</div>
  170.         </div></td>
  171.         <td><div align="center"><span class="style3"> <%=(TotalCallsbyTeam.Fields.Item("SumOfNumberofCalls").Value)%> </span></div></td>
  172.         <td><div align="center"><span class="style3"><%=(Totals.Fields.Item("Total of MediaRoute").Value)%></span></div></td>
  173.         <td><div align="center"><strong class="style8"><%= FormatNumber(((Totals.Fields.Item("Total of MediaRoute").Value)) / ((TotalCallsbyTeam.Fields.Item("SumOfNumberofCalls").Value)/100), 2, -2, -2, -2)%>%</strong></div></td>
  174.     </tr>
  175.   </table>
  176.   <form id="form1" name="form1" method="post" action="">
  177.     <p class="style1">&nbsp;</p>
  178.     <p>&nbsp;</p>
  179.   </form>
  180.   <p><img src="http://bytes.com/topic/asp-classic/images/LSGlogoWallboard.gif" alt="LSG" width="124" height="100" /></p>
  181. </div>
  182. <div align="center"></div>
  183. </body>
  184. </html>
  185. <%
  186. Totals.Close()
  187. Set Totals = Nothing
  188. %>
  189. <%
  190. Recordset2.Close()
  191. Set Recordset2 = Nothing
  192. %>
  193. <%
  194. TotalCallsbyTeam.Close()
  195. Set TotalCallsbyTeam = Nothing
  196. %>
  197. <%
  198. TeamConversion.Close()
  199. Set TeamConversion = Nothing
  200. %>
Aug 15 '12 #3

Rabbit
Expert Mod 10K+
P: 12,370
The page should make an AJAX call to get updated information. You can then use javascript to compare the old value against the new value retreived with AJAX.
Aug 15 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.