response.write blue font in asp

Greeting,

I have the following line in asp and need to write the fonts in blue. Please suggest.

Response.Write "Grand Total: " +FormatCurrency(CStr(total),2)


Thanks.
mrongAsked:
Who is Participating?
 
WebDevEMCommented:
Sorry, I copy/pasted your original code and added the coloring... combining 2 strings should be done with "&" not "+" and the Response.Write needs parens around it:
Response.Write ("Grand Total: <span style='color:#00f;'>" & FormatCurrency(CStr(total),2) & "</span>")

Open in new window


I don't have an ASP server I can test this on quickly, but that should do it.  I'll try to connect to a server and see if I can test it out.

UPDATE:  If I change the "total" to 100 it works on my server.  What is your "total" variable defined as?  If ASP can't convert total with CStr, then it could fail when it tries to format it as currency.
0
 
WebDevEMCommented:
Response.Write "Grand Total: <span style='color:#00f;'>" +FormatCurrency(CStr(total),2) + "</span>"

Open in new window

0
 
mrongAuthor Commented:
Tried and got the following error.

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FormatCurrency'
0
 
mrongAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.