Announcement

Collapse
No announcement yet.

web graphic help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    web graphic help

    I am trying to make a web page that use the on and off.gif files. I need to put the light bulb on the web page next the on/off


    What is the best way to do this in the code below?

    I tried the <img............> statment but just get syntax errors

    code below:


    %> </td>
    <td rowspan="12"><%
    for count=1 to 16
    house_code="E"
    if count="6" then
    house_code="F"
    end if
    if count="7" then
    house_code ="G"
    end if
    if count="8" then
    house_code="H"
    end if

    s=hs.DeviceString(house_code +cstr(count))
    status1=hs.DeviceStatus(house_code +cstr(count))
    if s="" then
    if status1="3" then
    status1="OFF"
    end if

    if status1="2" then
    status1="ON"
    end if
    if status1="4" then
    status1="DIM"
    end if
    if status1="17" then
    status1="UNKNOWN"
    end if

    end if

    I=hs.DeviceExists(house_code +cstr(count))
    response.write "<p> </p>"
    if I="-1" then
    response.write "space not used"+cstr(s)
    else
    if s="" then
    if status1="OFF" then

    ' response.write <img src="off.gif" border="0" width="16" height="16" alt="" align="left">
    ' need to insert the on or off gif file into the web page here
    ' I get a syntax error with the above

    end if
    response.write " "+cstr(status1)
    else
    response.write " "+cstr(s)
    end if
    end if
    next
    %> </td>

    regards

    Ray

    #2
    I think you have quotes problem.

    response.write "<img src=""off.gif"" border=""0"" width=""16"" height=""16"" align=""left"">"
    You will also likely want to put the graphic and the text into a table so you have better control as to its positioning. You then can specific a size and alignment.

    Comment


      #3
      Ray,

      The data for response.write needs to be enclosed in quotes if you sending it as a string vs. writing out the value of a variable. Since you have quotes embedded in the string you want to send, you will need to double quote each quote or try using a single quotes. (talk about double talk)

      Try this:
      response.write "<img src=""off.gif"" border=""0"" width=""16"" height=""16"" alt="""" align=""left"">"

      This might work too but I'm not 100% positive:
      response.write "<img src='off.gif' border='0' width='16' height='16' alt='' align='left'>"

      I've also seen some instances where the parameters don't need quotes at all but I'm not sure what the rules are on that. Perhaps someone more knowledgeable can fill us in.

      Don't quote me on any of this.

      Good luck.

      Joe
      HomeSeer Rocks!

      Comment


        #4
        You may not need logic like this in this particular case but here is another way you can response.write by using a variable and this is also an example of when you don’t use quotes.

        Dim imgStatus
        Dim foo

        If foo="ON" then
        imgStatus="on.gif"
        else
        imgStatus="off.gif"
        end if

        'This will write out for both cases of ON or OFF
        response.write "<img src="""
        response.write imgStatus
        response.write """ border=""0"" width=""16"" height=""16"" alt="""" align=""left"">"

        Joe
        HomeSeer Rocks!

        Comment


          #5
          The double Quote worked thank you for the help.

          I have an other question?

          How do you make a link to other part of the same page.

          Thank you
          Ray

          Comment


            #6
            Ray,

            You need an anchor. Here is a link that Rupp posted a few weeks back that does a good job explaining anchors.

            http://archive.ncsa.uiuc.edu/General...o/anchors.html

            Joe
            HomeSeer Rocks!

            Comment

            Working...
            X