www.webdeveloper.com
Results 1 to 8 of 8

Thread: onclick do addition - help please!

  1. #1
    Join Date
    Nov 2013
    Posts
    7

    Question onclick do addition - help please!

    I have a number of buttons and would like to display a counter that increments each time you click any button. Also you can only click on a button once. Therefore clicking on the same button twice will not increment again.

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,356

    Question

    Show at least some HTML to see the intent of what your are trying to do.
    Too little information to start with. We could only guess at the desired result.

  3. #3
    Join Date
    Nov 2013
    Posts
    7
    I am doing a research paper and part of my study is to conduct an experiment which will involve a sort of an online game similar to a maze.

    Below, I will explain in detail:

    Positivity Game Experiment

    The game is designed in the form of a table with 50 sections; each section has a selection of two numbers where one number is positive (+1) and the other is negative (-1). The numbers to be selected are revealed while their positivity or negativity are hidden and can be revealed only after the selection was made and thus, decision-making is merely based on the gut feeling and luck. The value of the game is to select as much as possible positive numbers in a time span of 5 minutes; resulting to a range between 0 to 50 positive numbers as a total.

    Each player has the opportunity to try the same game again in another time span of 5 minutes; leading the opportunity to memorize the results from the first tryout so that decision-making would not only rely merely on the gut feeling but also from the knowledge gained by the memory.

    The player may compare the first result to the second and compare whether the gut feeling is more effective than memory. A sample of 50 participants will be involved for the game.

    Will be something like this:

    Please select 1 (right) or 1 (left)


    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1
    1 or 1 1 or 1 1 or 1 1 or 1 1 or 1

    Total Amount: ____ (Time taken: ___)

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,356

    Lightbulb

    This is not your entire desire, but is should give you a start...
    Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8" />
    <title> Untitled </title>
    <style type="text/css">
     .rcCell { height:50px; width:75px; text-align:center; visibility:hidden; } 
    </style>
    
    <script type="text/javascript">
    function showCell(Tid) { // alert(Tid);
      Tid = Tid.toLowerCase();
      document.getElementById(Tid).style.visibility = 'visible';
      sum += Number(document.getElementById(Tid).innerHTML);
      document.getElementById('results').innerHTML = "Sum: "+sum;
    }
    function showSequence(arr) {
      var str = '';  var n;
      for (var r=0; r<arr.length; r++) {
        n = arr[r].toString();  if (n.length < 2) { n = ' '+n; }
        str += '['+n+']    ';  if ((r % 5) == 4) { str += '\n\n'; }
      }
      return str;
    }
    </script>
    
    </head>
    <body>
    <div id="results"></div>
    <div id="gameTable" style="position:absolute; top:100px; left:200px;"></div>
    <button onclick="alert(showSequence(sequence))">Spoiler</button>
    
    <script type="text/javascript">
    var sum = 0;  var sequence = [];
    window.onload = function() {
      var i, ids;
      var PosNeg = [1,-1];
      sum = 0;
      var str = '<table border="1" style="text-align:center">';
      for (var r=0; r<10; r++) {
        str += '<tr>'
        for (var c=0; c<5; c++) {
          rc = r.toString()+c.toString();
          i = PosNeg[Math.floor(Math.random()*2)];
          sequence.push(i);
          str += '<th id="RC'+rc+'" onclick="showCell(this.id)">';
          str += '<div id="rc'+rc+'" class="rcCell">'+i+'</div>';
          str += '</th>'
        }
        str += '</tr>'
      }
      document.getElementById('gameTable').innerHTML = str;
    }
    </script>
    
    </body>
    </html>
    Good Luck!

  5. #5
    Join Date
    Nov 2013
    Posts
    7

    Question

    The below is what id did. I need the timer to start from 5 minutes and count downwards. When it reaches 0 it will disable all the buttons and display TIME UP YOU PRESSED 'X' POSITIVE BUTTONS. Also I need to add a counter that will count each '+' (positive) button pressed and when it reaches 50 it will display YOU PRESSED 'X' NUMBER OF BUTTONS IN 'X' TIME. Is this possible?

    <html>
    <html>
    <head>
    <script type="text/javascript">
    var c=0;
    var t;
    var timer_is_on=0;

    function timedCount()
    {
    document.getElementById('txt').value=c;
    c=c+1;
    t=setTimeout("timedCount()",1000);
    }

    function doTimer()
    {
    if (!timer_is_on)
    {
    timer_is_on=1;
    timedCount();
    }
    }

    function stopCount()
    {
    clearTimeout(t);
    timer_is_on=0;
    }

    function FP_changeProp() {//v1.0
    var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
    d.$cpe=new Array(); if(o) for(i=2; i<args.length; i+=2) { v=args[i+1]; s="o";
    ao=args[i].split("."); for(j=0; j<ao.length; j++) { s+="."+ao[j]; if(null==eval(s)) {
    s=null; break; } } x=new Object; x.o=o; x.n=new Array(); x.v=new Array();
    x.n[x.n.length]=s; eval("x.v[x.v.length]="+s); d.$cpe[d.$cpe.length]=x;
    if(s) eval(s+"=v"); }
    }

    function FP_getObjectByID(id,o) {//v1.0
    var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
    else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
    if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
    for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
    f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
    for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
    return null;
    }
    </script>
    </head>
    <body>
    <form>
    <input type="button" value=" 1" onclick="value=&quot;+1&quot;; doTimer(); FP_changeProp(/*id*/'_1b',0,'style.visibility','hidden');" name="_1a" style="width: 40px">
    <input type="button" value=" 1" onclick="value=&quot;-1&quot;; doTimer(); FP_changeProp(/*id*/'_1a',0,'style.visibility','hidden');" name="_1b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 2" onclick="value=&quot;+2&quot;; doTimer(); FP_changeProp(/*id*/'_2b',0,'style.visibility','hidden');" name="_2a"style="width: 40px">
    <input type="button" value=" 2" onclick="value=&quot;-2&quot;; doTimer(); FP_changeProp(/*id*/'_2a',0,'style.visibility','hidden');" name="_2b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 3" onclick="value=&quot;+3&quot;; doTimer(); FP_changeProp(/*id*/'_3b',0,'style.visibility','hidden');" name="_3a"style="width: 40px">
    <input type="button" value=" 3" onclick="value=&quot;-3&quot;; doTimer(); FP_changeProp(/*id*/'_3a',0,'style.visibility','hidden');" name="_3b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 4" onclick="value=&quot;+4&quot;; doTimer(); FP_changeProp(/*id*/'_4b',0,'style.visibility','hidden');" name="_4a"style="width: 40px">
    <input type="button" value=" 4" onclick="value=&quot;-4&quot;; doTimer(); FP_changeProp(/*id*/'_4a',0,'style.visibility','hidden');" name="_4b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 5" onclick="value=&quot;+5&quot;; doTimer(); FP_changeProp(/*id*/'_5b',0,'style.visibility','hidden');" name="_5a"style="width: 40px">
    <input type="button" value=" 5" onclick="value=&quot;-5&quot;; doTimer(); FP_changeProp(/*id*/'_5a',0,'style.visibility','hidden');" name="_5b"style="width: 40px">
    <br>
    <input type="button" value=" 6" onclick="value=&quot;-6&quot;; doTimer(); FP_changeProp(/*id*/'_6b',0,'style.visibility','hidden');" name="_6a"style="width: 40px">
    <input type="button" value=" 6" onclick="value=&quot;+6&quot;; doTimer(); FP_changeProp(/*id*/'_6a',0,'style.visibility','hidden');" name="_6b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 7" onclick="value=&quot;+7&quot;; doTimer(); FP_changeProp(/*id*/'_7b',0,'style.visibility','hidden');" name="_7a"style="width: 40px">
    <input type="button" value=" 7" onclick="value=&quot;-7&quot;; doTimer(); FP_changeProp(/*id*/'_7a',0,'style.visibility','hidden');" name="_7b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 8" onclick="value=&quot;+8&quot;; doTimer(); FP_changeProp(/*id*/'_8b',0,'style.visibility','hidden');" name="_8a"style="width: 40px">
    <input type="button" value=" 8" onclick="value=&quot;-8&quot;; doTimer(); FP_changeProp(/*id*/'_8a',0,'style.visibility','hidden');" name="_8b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value=" 9" onclick="value=&quot;-9&quot;; doTimer(); FP_changeProp(/*id*/'_9b',0,'style.visibility','hidden');" name="_9a"style="width: 40px">
    <input type="button" value=" 9" onclick="value=&quot;+9&quot;; doTimer(); FP_changeProp(/*id*/'_9a',0,'style.visibility','hidden');" name="_9b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="10" onclick="value=&quot;+10&quot;; doTimer(); FP_changeProp(/*id*/'_10b',0,'style.visibility','hidden');" name="_10a"style="width: 40px">
    <input type="button" value="10" onclick="value=&quot;-10&quot;; doTimer(); FP_changeProp(/*id*/'_10a',0,'style.visibility','hidden');" name="_10b"style="width: 40px">
    <br>
    <input type="button" value="11" onclick="value=&quot;+11&quot;; doTimer(); FP_changeProp(/*id*/'_11b',0,'style.visibility','hidden');" name="_11a"style="width: 40px">
    <input type="button" value="11" onclick="value=&quot;-11&quot;; doTimer(); FP_changeProp(/*id*/'_11a',0,'style.visibility','hidden');" name="_11b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="12" onclick="value=&quot;-12&quot;; doTimer(); FP_changeProp(/*id*/'_12b',0,'style.visibility','hidden');" name="_12a"style="width: 40px">
    <input type="button" value="12" onclick="value=&quot;+12&quot;; doTimer(); FP_changeProp(/*id*/'_12a',0,'style.visibility','hidden');" name="_12b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="13" onclick="value=&quot;+13&quot;; doTimer(); FP_changeProp(/*id*/'_13b',0,'style.visibility','hidden');" name="_13a"style="width: 40px">
    <input type="button" value="13" onclick="value=&quot;-13&quot;; doTimer(); FP_changeProp(/*id*/'_13a',0,'style.visibility','hidden');" name="_13b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="14" onclick="value=&quot;+14&quot;; doTimer(); FP_changeProp(/*id*/'_14b',0,'style.visibility','hidden');" name="_14a"style="width: 40px">
    <input type="button" value="14" onclick="value=&quot;-14&quot;; doTimer(); FP_changeProp(/*id*/'_14a',0,'style.visibility','hidden');" name="_14b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="15" onclick="value=&quot;-15&quot;; doTimer(); FP_changeProp(/*id*/'_15b',0,'style.visibility','hidden');" name="_15a"style="width: 40px">
    <input type="button" value="15" onclick="value=&quot;+15&quot;; doTimer(); FP_changeProp(/*id*/'_15a',0,'style.visibility','hidden');" name="_15b"style="width: 40px">
    <br>
    <input type="button" value="16" onclick="value=&quot;+16&quot;; doTimer(); FP_changeProp(/*id*/'_16b',0,'style.visibility','hidden');" name="_16a"style="width: 40px">
    <input type="button" value="16" onclick="value=&quot;-16&quot;; doTimer(); FP_changeProp(/*id*/'_16a',0,'style.visibility','hidden');" name="_16b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="17" onclick="value=&quot;+17&quot;; doTimer(); FP_changeProp(/*id*/'_17b',0,'style.visibility','hidden');" name="_17a"style="width: 40px">
    <input type="button" value="17" onclick="value=&quot;-17&quot;; doTimer(); FP_changeProp(/*id*/'_17a',0,'style.visibility','hidden');" name="_17b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="18" onclick="value=&quot;-18&quot;; doTimer(); FP_changeProp(/*id*/'_18b',0,'style.visibility','hidden');" name="_18a"style="width: 40px">
    <input type="button" value="18" onclick="value=&quot;+18&quot;; doTimer(); FP_changeProp(/*id*/'_18a',0,'style.visibility','hidden');" name="_18b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="19" onclick="value=&quot;+19&quot;; doTimer(); FP_changeProp(/*id*/'_19b',0,'style.visibility','hidden');" name="_19a"style="width: 40px">
    <input type="button" value="19" onclick="value=&quot;-19&quot;; doTimer(); FP_changeProp(/*id*/'_19a',0,'style.visibility','hidden');" name="_19b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="20" onclick="value=&quot;+20&quot;; doTimer(); FP_changeProp(/*id*/'_20b',0,'style.visibility','hidden');" name="_20a"style="width: 40px">
    <input type="button" value="20" onclick="value=&quot;-20&quot;; doTimer(); FP_changeProp(/*id*/'_20a',0,'style.visibility','hidden');" name="_20b"style="width: 40px">
    <br>

    continued on next reply...

  6. #6
    Join Date
    Nov 2013
    Posts
    7
    <input type="button" value="21" onclick="value=&quot;-21&quot;; doTimer(); FP_changeProp(/*id*/'_21b',0,'style.visibility','hidden');" name="_21a"style="width: 40px">
    <input type="button" value="21" onclick="value=&quot;+21&quot;; doTimer(); FP_changeProp(/*id*/'_21a',0,'style.visibility','hidden');" name="_21b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="22" onclick="value=&quot;+22&quot;; doTimer(); FP_changeProp(/*id*/'_22b',0,'style.visibility','hidden');" name="_22a"style="width: 40px">
    <input type="button" value="22" onclick="value=&quot;-22&quot;; doTimer(); FP_changeProp(/*id*/'_22a',0,'style.visibility','hidden');" name="_22b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="23" onclick="value=&quot;+23&quot;; doTimer(); FP_changeProp(/*id*/'_23b',0,'style.visibility','hidden');" name="_23a"style="width: 40px">
    <input type="button" value="23" onclick="value=&quot;-23&quot;; doTimer(); FP_changeProp(/*id*/'_23a',0,'style.visibility','hidden');" name="_23b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="24" onclick="value=&quot;-24&quot;; doTimer(); FP_changeProp(/*id*/'_24b',0,'style.visibility','hidden');" name="_24a"style="width: 40px">
    <input type="button" value="24" onclick="value=&quot;+24&quot;; doTimer(); FP_changeProp(/*id*/'_24a',0,'style.visibility','hidden');" name="_24b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="25" onclick="value=&quot;+25&quot;; doTimer(); FP_changeProp(/*id*/'_25b',0,'style.visibility','hidden');" name="_25a"style="width: 40px">
    <input type="button" value="25" onclick="value=&quot;-25&quot;; doTimer(); FP_changeProp(/*id*/'_25a',0,'style.visibility','hidden');" name="_25b"style="width: 40px">
    <br>
    <input type="button" value="26" onclick="value=&quot;+26&quot;; doTimer(); FP_changeProp(/*id*/'_26b',0,'style.visibility','hidden');" name="_26a"style="width: 40px">
    <input type="button" value="26" onclick="value=&quot;-26&quot;; doTimer(); FP_changeProp(/*id*/'_26a',0,'style.visibility','hidden');" name="_26b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="27" onclick="value=&quot;-27&quot;; doTimer(); FP_changeProp(/*id*/'_27b',0,'style.visibility','hidden');" name="_27a"style="width: 40px">
    <input type="button" value="27" onclick="value=&quot;+27&quot;; doTimer(); FP_changeProp(/*id*/'_27a',0,'style.visibility','hidden');" name="_27b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="28" onclick="value=&quot;+28&quot;; doTimer(); FP_changeProp(/*id*/'_28b',0,'style.visibility','hidden');" name="_28a"style="width: 40px">
    <input type="button" value="28" onclick="value=&quot;-28&quot;; doTimer(); FP_changeProp(/*id*/'_28a',0,'style.visibility','hidden');" name="_28b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="29" onclick="value=&quot;+29&quot;; doTimer(); FP_changeProp(/*id*/'_29b',0,'style.visibility','hidden');" name="_29a"style="width: 40px">
    <input type="button" value="29" onclick="value=&quot;-29&quot;; doTimer(); FP_changeProp(/*id*/'_29a',0,'style.visibility','hidden');" name="_29b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="30" onclick="value=&quot;-30&quot;; doTimer(); FP_changeProp(/*id*/'_30b',0,'style.visibility','hidden');" name="_30a"style="width: 40px">
    <input type="button" value="30" onclick="value=&quot;+30&quot;; doTimer(); FP_changeProp(/*id*/'_30a',0,'style.visibility','hidden');" name="_30b"style="width: 40px">
    <br>
    <input type="button" value="31" onclick="value=&quot;+31&quot;; doTimer(); FP_changeProp(/*id*/'_31b',0,'style.visibility','hidden');" name="_31a"style="width: 40px">
    <input type="button" value="31" onclick="value=&quot;-31&quot;; doTimer(); FP_changeProp(/*id*/'_31a',0,'style.visibility','hidden');" name="_31b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="32" onclick="value=&quot;+32&quot;; doTimer(); FP_changeProp(/*id*/'_32b',0,'style.visibility','hidden');" name="_32a"style="width: 40px">
    <input type="button" value="32" onclick="value=&quot;-32&quot;; doTimer(); FP_changeProp(/*id*/'_32a',0,'style.visibility','hidden');" name="_32b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="33" onclick="value=&quot;-33&quot;; doTimer(); FP_changeProp(/*id*/'_33b',0,'style.visibility','hidden');" name="_33a"style="width: 40px">
    <input type="button" value="33" onclick="value=&quot;+33&quot;; doTimer(); FP_changeProp(/*id*/'_33a',0,'style.visibility','hidden');" name="_33b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="34" onclick="value=&quot;+34&quot;; doTimer(); FP_changeProp(/*id*/'_34b',0,'style.visibility','hidden');" name="_34a"style="width: 40px">
    <input type="button" value="34" onclick="value=&quot;-34&quot;; doTimer(); FP_changeProp(/*id*/'_34a',0,'style.visibility','hidden');" name="_34b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="35" onclick="value=&quot;+35&quot;; doTimer(); FP_changeProp(/*id*/'_35b',0,'style.visibility','hidden');" name="_35a"style="width: 40px">
    <input type="button" value="35" onclick="value=&quot;-35&quot;; doTimer(); FP_changeProp(/*id*/'_35a',0,'style.visibility','hidden');" name="_35b"style="width: 40px">
    <br>
    <input type="button" value="36" onclick="value=&quot;-36&quot;; doTimer(); FP_changeProp(/*id*/'_36b',0,'style.visibility','hidden');" name="_36a"style="width: 40px">
    <input type="button" value="36" onclick="value=&quot;+36&quot;; doTimer(); FP_changeProp(/*id*/'_36a',0,'style.visibility','hidden');" name="_36b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="37" onclick="value=&quot;+37&quot;; doTimer(); FP_changeProp(/*id*/'_37b',0,'style.visibility','hidden');" name="_37a"style="width: 40px">
    <input type="button" value="37" onclick="value=&quot;-37&quot;; doTimer(); FP_changeProp(/*id*/'_37a',0,'style.visibility','hidden');" name="_37b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="38" onclick="value=&quot;+38&quot;; doTimer(); FP_changeProp(/*id*/'_38b',0,'style.visibility','hidden');" name="_38a"style="width: 40px">
    <input type="button" value="38" onclick="value=&quot;-38&quot;; doTimer(); FP_changeProp(/*id*/'_38a',0,'style.visibility','hidden');" name="_38b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="39" onclick="value=&quot;-39&quot;; doTimer(); FP_changeProp(/*id*/'_39b',0,'style.visibility','hidden');" name="_39a"style="width: 40px">
    <input type="button" value="39" onclick="value=&quot;+39&quot;; doTimer(); FP_changeProp(/*id*/'_39a',0,'style.visibility','hidden');" name="_39b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="40" onclick="value=&quot;+40&quot;; doTimer(); FP_changeProp(/*id*/'_40b',0,'style.visibility','hidden');" name="_40a"style="width: 40px">
    <input type="button" value="40" onclick="value=&quot;-40&quot;; doTimer(); FP_changeProp(/*id*/'_40a',0,'style.visibility','hidden');" name="_40b"style="width: 40px">
    <br>

    continued on next reply...

  7. #7
    Join Date
    Nov 2013
    Posts
    7
    <input type="button" value="41" onclick="value=&quot;+41&quot;; doTimer(); FP_changeProp(/*id*/'_41b',0,'style.visibility','hidden');" name="_41a"style="width: 40px">
    <input type="button" value="41" onclick="value=&quot;-41&quot;; doTimer(); FP_changeProp(/*id*/'_41a',0,'style.visibility','hidden');" name="_41b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="42" onclick="value=&quot;-42&quot;; doTimer(); FP_changeProp(/*id*/'_42b',0,'style.visibility','hidden');" name="_42a"style="width: 40px">
    <input type="button" value="42" onclick="value=&quot;+42&quot;; doTimer(); FP_changeProp(/*id*/'_42a',0,'style.visibility','hidden');" name="_42b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="43" onclick="value=&quot;+43&quot;; doTimer(); FP_changeProp(/*id*/'_43b',0,'style.visibility','hidden');" name="_43a"style="width: 40px">
    <input type="button" value="43" onclick="value=&quot;-43&quot;; doTimer(); FP_changeProp(/*id*/'_43a',0,'style.visibility','hidden');" name="_43b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="44" onclick="value=&quot;+44&quot;; doTimer(); FP_changeProp(/*id*/'_44b',0,'style.visibility','hidden');" name="_44a"style="width: 40px">
    <input type="button" value="44" onclick="value=&quot;-44&quot;; doTimer(); FP_changeProp(/*id*/'_44a',0,'style.visibility','hidden');" name="_44b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="45" onclick="value=&quot;-45&quot;; doTimer(); FP_changeProp(/*id*/'_45b',0,'style.visibility','hidden');" name="_45a"style="width: 40px">
    <input type="button" value="45" onclick="value=&quot;+45&quot;; doTimer(); FP_changeProp(/*id*/'_45a',0,'style.visibility','hidden');" name="_45b"style="width: 40px">
    <br>
    <input type="button" value="46" onclick="value=&quot;+46&quot;; doTimer(); FP_changeProp(/*id*/'_46b',0,'style.visibility','hidden');" name="_46a"style="width: 40px">
    <input type="button" value="46" onclick="value=&quot;-46&quot;; doTimer(); FP_changeProp(/*id*/'_46a',0,'style.visibility','hidden');" name="_46b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="47" onclick="value=&quot;+47&quot;; doTimer(); FP_changeProp(/*id*/'_47b',0,'style.visibility','hidden');" name="_47a"style="width: 40px">
    <input type="button" value="47" onclick="value=&quot;-47&quot;; doTimer(); FP_changeProp(/*id*/'_47a',0,'style.visibility','hidden');" name="_47b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="48" onclick="value=&quot;-48&quot;; doTimer(); FP_changeProp(/*id*/'_48b',0,'style.visibility','hidden');" name="_48a"style="width: 40px">
    <input type="button" value="48" onclick="value=&quot;+48&quot;; doTimer(); FP_changeProp(/*id*/'_48a',0,'style.visibility','hidden');" name="_48b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="49" onclick="value=&quot;+49&quot;; doTimer(); FP_changeProp(/*id*/'_49b',0,'style.visibility','hidden');" name="_49a"style="width: 40px">
    <input type="button" value="49" onclick="value=&quot;-49&quot;; doTimer(); FP_changeProp(/*id*/'_49a',0,'style.visibility','hidden');" name="_49b"style="width: 40px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="50" onclick="value=&quot;+50&quot;; doTimer(); FP_changeProp(/*id*/'_50b',0,'style.visibility','hidden');" name="_50a"style="width: 40px">
    <input type="button" value="50" onclick="value=&quot;-50&quot;; doTimer(); FP_changeProp(/*id*/'_50a',0,'style.visibility','hidden');" name="_50b"style="width: 40px">

    <br>&nbsp;<br><input type="text" id="txt" style="width: 102px" name="timer" value="0" />seconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" value="Stop Timer" onclick="stopCount()" /> <br><br> <br><br>
    </form>
    <p>
    Click on the any button above to start the timer. The input field will count forever, starting at 0. Click on the "Stop
    Timer" button to stop the counting.</p>
    </body>
    </html>
    </html>

  8. #8
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,356

    Question

    Way too complicated!

    Why not start with the example I provided and expand on that?

    Why do you "doTimer()" each button press?
    Why do you have the FP_changeProp() hard coded into each button?

    I need to go to work now. I'll check back later.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles