Announcement

Collapse
No announcement yet.

Getting Sub to work...

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

  • Getting Sub to work...

    sub Reset_OnClick
    if hs.ison("M5") then
    hs.execx10 "M5","off",0
    end if
    hs.WaitEvents
    if hs.isoff("M5") then
    hs.execx10 "M5","on",0
    end if
    end sub

    [other html code]

    <form>
    <input type="button" value="Reset Camera" name=Reset>
    </form>

    Clicking the button does not execute the sub?? Not sure why??

  • #2
    sub Reset_OnClick
    if hs.ison("M5") then
    hs.execx10 "M5","off",0
    end if
    hs.WaitEvents
    if hs.isoff("M5") then
    hs.execx10 "M5","on",0
    end if
    end sub

    [other html code]

    <FORM>
    form
    input type="button" value="Reset Camera" name=Reset
    form


    Clicking the button does not execute the sub?? Not sure why??

    Comment


    • #3
      Rich,
      Is this in an asp page or html page?


      Another point as well. The code:
      Code:
      sub Reset_OnClick 
      if hs.ison("M5") then 
      hs.execx10 "M5","off",0 
      end if
      hs.WaitEvents 
      if hs.isoff("M5") then 
      hs.execx10 "M5","on",0 
      end if 
      end sub
      Is going to cycle the device. Is that what your after?
      -Rupp
      sigpic

      Comment


      • #4
        ASP...

        Yes I just want to be able to cycle the camera if I think it needs it... It will be plugged in in a very hard to get to place and I want to be able to turn if off and on when I want to and cycle it if need be...

        Comment


        • #5
          Rich,
          You didn't show it but in order to call that sub you need a line in your asp file to grab the form data and process it. Something like"

          PHP Code:
          val request.form("reset")
          if 
          val "Reset Camera" then 
           
          if hs.ison("M5"then 
              hs
          .execx10 "M5","off",
           end 
          if
           
          hs.WaitEvents 
           
          if hs.isoff("M5"then 
             hs
          .execx10 "M5","on",
           end 
          if 
          end if 
          Last edited by Rupp; January 30th, 2005, 10:20 AM.
          -Rupp
          sigpic

          Comment


          • #6
            In my reading I was under the impression that if it is an ASP page the VBScript base sub would work as they had is listed... I say that to say that a form input of type "button" has built in events right?? Like the [button name]_OnClick...


            So clicking the button named Reset should have executed the sub Reset_OnClick... Did I not read that correctly??

            Comment


            • #7
              Rich,
              That will work in IE but I'm not sure about any other browser. If that is the way you want to do it then it has to be like this:

              PHP Code:
              'Do not need form tags.
              <INPUT TYPE="BUTTON" class="button2" NAME="MyReset" VALUE="Reset Camera">

              <SCRIPT FOR="MyReset" EVENT="onclick">
                    Your code in here
              </SCRIPT> 
              -Rupp
              sigpic

              Comment


              • #8
                I would like it to work in all browsers... How would you do it??

                Comment

                Working...
                X