response.write blue font in asp

Posted on 2012-08-13
Last Modified: 2012-08-13

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)

Question by:mrong
    LVL 9

    Expert Comment

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

    Open in new window


    Author Comment

    Tried and got the following error.

    Microsoft VBScript runtime error '800a000d'

    Type mismatch: 'FormatCurrency'
    LVL 9

    Accepted Solution

    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 Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now