VBS change row colour condition

Author Message
evilradish

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 7/23/2010
  • Status: offline
VBS change row colour condition Friday, July 23, 2010 1:21 AM (permalink)
0
I am very new to vbs (in fact code writing in general) so any assistance will be fantastic
 
I am writing a asp page that looks at locations on my nas and brings back file sizes. Once it has the size if its greater than x turn cell red and if its lower than x turn cell green.
 
I have got this working apart from the colour part
 
Could anyone assist me please.
 
Thank You
(1st post of many to come I am sure)
 
Code
 
<html>
<head>
<title>Access DB watch</title>
</head>
<body>
<body bgcolor="silver" text="black">
<table border="1" name="bob">
 <tr>
 <td>  
  
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("file://nas01/music/music.mdb")
Response.Write("file://nas01/music/music.mdb ")
Response.Write( f.Size & "bytes.")
if (f.size < 500)
        Row.background = Color.Red;
set f=nothing
set fs=nothing
%>
</td>
</tr>
</body>
</html>
 
 
Thanks
 
#1
    evilradish

    • Total Posts : 4
    • Scores: 0
    • Reward points : 0
    • Joined: 7/23/2010
    • Status: offline
    Re:VBS change row colour condition Thursday, August 05, 2010 8:18 PM (permalink)
    0
    bump this plz
     
    #2
      demonscout

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 10/9/2010
      • Status: offline
      Re:VBS change row colour condition Saturday, October 09, 2010 12:18 AM (permalink)
      0
      Hi evil radish,
          the way to change the background colour of you table cell is in actually adding in the css styling required to change the colour for that cell, or a css calss to do that I am not sure where you got "Row.background = Color.Red; " but this is not asp, and looks more like javascript.

      What you need to do is firstly run the logic to find the size of the file you are checking and then set up the style to apply to the table cell along with what you want to display in the cell

      So using you code something like this

      Code
       
      <html>
      <head>
      <title>Access DB watch</title>
      </head>
      <body bgcolor="silver" text="black">
      <%
      dim fs,f
      set fs=Server.CreateObject("Scripting.FileSystemObject")
      set f=fs.GetFile("file://nas01/music/music.mdb")
      dim filename:filename = ("file://nas01/music/music.mdb ")
      dim filesize:filesize = f.Size & "bytes."
      dim tdStyle
      if (f.size < 500) then
          tdStyle = "background: #00FF00;"
      else
          tdStyle = "background: #FF0000;"
      end if
            
      set f=nothing
      set fs=nothing
      %>

      <table border="1" name="bob">
       <tr>
       <td style="<% response.write(tdStyle) %>">  
      <% = response.write(filename &  filesize) %>  
      </td>
      </tr>
      </body>
      </html>
       
      [code]

      That should get you going.
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9