Using ASP variables with HTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leeper

    Using ASP variables with HTML

    Here is the line that I am using.
    response.write( "<p style='color:" & Item"'></p>")
    the word Item is a variable with hex code in it for color. This is
    pretty simple I think, but how can I get this variable to work with
    this HTML. Any help would be greatly appreciated.

    Thanks
    Ryan
  • Ray at

    #2
    Re: Using ASP variables with HTML

    What isn't working about it? Are you getting an error of some sort? It
    seems fine to me, although I'd change the variable name to something along
    the lines of sColor.

    Ray at work

    "Leeper" <jrob2542@yahoo .com> wrote in message
    news:6ba7f32f.0 402251252.228f3 6e6@posting.goo gle.com...[color=blue]
    > Here is the line that I am using.
    > response.write( "<p style='color:" & Item"'></p>")
    > the word Item is a variable with hex code in it for color. This is
    > pretty simple I think, but how can I get this variable to work with
    > this HTML. Any help would be greatly appreciated.
    >
    > Thanks
    > Ryan[/color]


    Comment

    • Peter Foti

      #3
      Re: Using ASP variables with HTML

      "Leeper" <jrob2542@yahoo .com> wrote in message
      news:6ba7f32f.0 402251252.228f3 6e6@posting.goo gle.com...[color=blue]
      > Here is the line that I am using.
      > response.write( "<p style='color:" & Item"'></p>")
      > the word Item is a variable with hex code in it for color. This is
      > pretty simple I think, but how can I get this variable to work with
      > this HTML. Any help would be greatly appreciated.[/color]

      You're missing an & after Item:

      Response.Write "<p style='color:" & Item & "'></p>")

      Regards,
      Peter Foti

      PS- My general philosophy is that inline styles are bad things. You would
      be better off defining a class or ID. Just my 2 cents.


      Comment

      • Ray at

        #4
        Re: Using ASP variables with HTML

        I take back my "It seems fine to me" statement after reading Peter's post.
        [;

        Ray at work

        "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
        message news:u2X%23fG%2 3%23DHA.2576@tk 2msftngp13.phx. gbl...[color=blue]
        > What isn't working about it? Are you getting an error of some sort? It
        > seems fine to me, although I'd change the variable name to something along
        > the lines of sColor.
        >
        > Ray at work
        >
        > "Leeper" <jrob2542@yahoo .com> wrote in message
        > news:6ba7f32f.0 402251252.228f3 6e6@posting.goo gle.com...[color=green]
        > > Here is the line that I am using.
        > > response.write( "<p style='color:" & Item"'></p>")
        > > the word Item is a variable with hex code in it for color. This is
        > > pretty simple I think, but how can I get this variable to work with
        > > this HTML. Any help would be greatly appreciated.
        > >
        > > Thanks
        > > Ryan[/color]
        >
        >[/color]


        Comment

        • Peter Foti

          #5
          Re: Using ASP variables with HTML

          "Peter Foti" <peter@Idontwan tnostinkingemai lfromyou.com> wrote in message
          news:103q3mhrhc i4h3b@corp.supe rnews.com...[color=blue]
          > "Leeper" <jrob2542@yahoo .com> wrote in message
          > news:6ba7f32f.0 402251252.228f3 6e6@posting.goo gle.com...[color=green]
          > > Here is the line that I am using.
          > > response.write( "<p style='color:" & Item"'></p>")
          > > the word Item is a variable with hex code in it for color. This is
          > > pretty simple I think, but how can I get this variable to work with
          > > this HTML. Any help would be greatly appreciated.[/color]
          >
          > You're missing an & after Item:
          >
          > Response.Write "<p style='color:" & Item & "'></p>")[/color]

          And I'm missing an opening ( after Write. :) Ooops.

          Should be:

          Response.Write( "<p style='color:" & Item & "'></p>" )
          or
          Response.Write "<p style='color:" & Item & "'></p>"

          -Peter


          Comment

          Working...