We help IT Professionals succeed at work.

response.write blue font in asp

mrong
mrong asked
on
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.
Comment
Watch Question

Commented:
Response.Write "Grand Total: <span style='color:#00f;'>" +FormatCurrency(CStr(total),2) + "</span>"

Open in new window

Author

Commented:
Tried and got the following error.

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FormatCurrency'
Commented:
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.

Author

Commented:
Thanks!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.