Announcement

Collapse
No announcement yet.

Anyone have a Script to run event(s) depending on # of clicks?

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

    Anyone have a Script to run event(s) depending on # of clicks?

    I'm looking for a script that will enable to same web page button to run different scripts and/or events depending on how many times it has been clicked.

    Example:

    button <Room1>
    - clicked 1st time, runs 'room1-on' event
    - clicked 2nd time, runs 'room1-off' event

    anyone have anything like this?

    #2
    See if this litle example can give you an idea of what you want. If not post back and we'll refine it a bit more.

    <pre class="ip-ubbcode-code-pre">
    &lt;HTML&gt;
    &lt;HEAD&gt;
    &lt;TITLE&gt;&lt;/TITLE&gt;

    &lt;script language="JavaScript"&gt;
    function oneclick()
    {
    if (test.clickme.value == "Click me")
    {
    test.clickme.value = "Click me again";
    }else{
    test.clickme.value = "Click me";
    }
    }

    &lt;/script&gt;

    &lt;/HEAD&gt;
    &lt;BODY&gt;
    &lt;form name="test" &gt;
    &lt;input type="button" id="clickme" value="Click me" onclick="oneclick()"&gt;
    &lt;/form&gt;
    &lt;/BODY&gt;
    &lt;/HTML&gt;
    </pre>

    -Rupp
    ...One Nation Under GOD, Indivisible, With Liberty And Justice For All.
    -Rupp
    sigpic

    Comment


      #3
      I've tried JavaScript and VBscript... I get the same Runtime Error either way when I click on the button: "Error: Object Expected"

      Here's the code I'm trying:
      <pre class="ip-ubbcode-code-pre">
      &lt;HEAD&gt;
      &lt;%
      function movie_scene()

      If scenes.movie.value = "Movie On" then
      scenes.movie.value = "Movie Off"
      Else
      scenes.movie.value = "Movie On"
      End If

      End Function
      %&gt;
      &lt;/HEAD&gt;


      &lt;form name="scenes" method="POST"&gt;
      &lt;input type="button" id="movie" value="Movie On" onclick="movie_scene()"&gt;
      &lt;/form&gt;
      </pre>


      Anyone have any ideas?

      Comment

      Working...
      X