how can i show maximum data after every 1 sec

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sajib0189
    New Member
    • Apr 2010
    • 2

    how can i show maximum data after every 1 sec

    Sir,

    i m very new in javascript program...

    please help me

    my problem is ...

    3 different text box showing 3 values (AC current phase difference) like: 130,133,135 in name of R,S,T and all values are changing/upgrading every seconds signal coming from turbine server.

    i need java script program calculate 1st which one is greater then minus other 2 from it and calculate maximum value from two new results and show it in webpage and final result must be upgrade after 1 second if R,S,T values change.

    i already used this code but it freeze after 1st result....



    Code:
    <script type="text/javascript">
    
    var R = parseInt(document.all('P3:0:0').innerText);  
    var S = parseInt(document.all('P3:1:0').innerText);
    var T = parseInt(document.all('P3:2:0').innerText);
    
     <!-**here P3:0:0,P3:1:0 & P3:2:0 are the id where inputs coming from server* ->
    
    var TS = Math.abs(T-S);
    var TR = Math.abs(T-R);
     
    //** I select here T is always bigger then other two**//
    
    if (TS>TR){ document.write(TS)
    }
    
    else { document.write(TR)
    }
    
    </script>

    the R,S,T input box code are written by supplier..



    Code:
    <td class="inner" align="left"><div class="value" id="P3:0:0"></div></td>
    
    <td class="inner" align="left"><div class="value" id="P3:1:0"></div></td>
    
    <td class="inner" align="left"><div class="value" id="P3:2:0"></div></td>
    i also used another code with click button but after clicking its show result in next page and result not upgrading in every seconds.

    here the code....



    Code:
    <script type="text/javascript">
    function showdiff(){
    var R = parseInt(document.all('P3:0:0').innerText);
    var S = parseInt(document.all('P3:1:0').innerText);
    var T = parseInt(document.all('P3:2:0').innerText);
    
    var TS = Math.abs(T-S);
    var TR = Math.abs(T-R);
    
    if (TS>TR){ document.write(TS)
    }
    
    else { document.write(TR)
    }
    }
    </script>
    
    <body onload = "showdiff()">
    
    <td class="inner">
    
    <div id="showdiff()" style="height: 1.5em; font-size: 2em; color: red;"></div>
    <input type="button" name="showdiff()" id="showdiff()" value="P. diff" onClick="showdiff()"/>
    
    </td>
    i need some modification code which must be show result in main page and upgrade final result after every seconds....


    please anybody help me ....

    regards
    Reply With Quote
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    var TS = Math.abs(T-S);
    var TR = Math.abs(T-R);
    This won't work. why?
    eg take
    R = 8, S = 1, T = 5
    TS = 4
    TR = 3

    You want one value to be 7, the other to be 3. Go through the if else cases correctly and figure out which number is the biggest.

    Comment

    • sajib0189
      New Member
      • Apr 2010
      • 2

      #3
      sorry, i found my result and solution from on another site

      see here:
      <link removed>
      Last edited by Frinavale; Apr 15 '10, 08:04 PM. Reason: please do not post links to competing forums

      Comment

      Working...