RE: CSS errors when setting values with asp session variables

Roger,
 
The answer is probably in the value of the session variables. I suspect when
the validator checks the page, the session variable is empty, but when you
check it, there is a value there. How is a value getting entered into the
session variable "RGB"? I don't know if the validator has cookies available
to it (and session variables are really just a form of cookies, albeit
temporary ones).
 
Change your code to this and see what happens:
 
<%
RGBValue=""
If IsEmpty(Session("RGB")) or IsNull(Session("RGB"))  _
    or Session("RGB")="" then RGBValue="FFFFCC" else RGBValue=Session("RGB")
Response.write "body{background:" & RGBValue & "}"
%>
 
--Doug


  _____  

From: Roger Withnell [mailto:roger@upperbridge.co.uk] 
Sent: Tuesday, January 16, 2007 6:33 AM
To: 'Douglas Perreault'
Subject: RE: CSS errors when setting values with asp session variables



Dear Doug

 

Thanks for your email. 

 

I am entering the url into the CSS validator.  As you say, the ASP
interpreter interprets the code into HTML which is returned to the
validator.  However:

 

If, within the style tags, I set body{background: #FFFFCC}, the validator
runs without errors.

 

But if, within the style tags, I set body{background: <%= Session("RGB") %>}
(actually my code is Response.Write "body{background:" & Session("RGB") &
"}") the validator gives the following error:  body:  Invalid number
background parse error.

 

If I view the pages source code in the browser, this CSS property looks
exactly the same either way.

 

I much appreciated your help.

 

Yours

 

Roger

Received on Tuesday, 16 January 2007 14:01:33 UTC