-1

I have an input field with an id that is used as a button. I want to call this "input button" every X second. How to call the onclick function and/or use its functionality to do this?

<input id="window.all.desktop.id_10.body.TCon1.btn_refresh" class="TDynBtn" type="button"
onclick="window.all.desktop.id_10.body.TCon1.btn_refresh.doClick(this,event)" 
onmouseout="window.all.desktop.id_10.body.TCon1.btn_refresh.onMouseOut(this)" 
onmouseover="window.all.desktop.id_10.body.TCon1.btn_refresh.onMouseOver(this)" 
value="Reload measurements">

My attempt to call it in PHP:

print "
   window.setInterval (
      function() {
         window.all.desktop.id_10.body.TCon1.btn_refresh.doClick(this,event);
      },
      ".$nSeconds."
     );
";

No jQuery possible.

Shlomo
  • 3,880
  • 8
  • 50
  • 82

2 Answers2

1

Try this:

var t = setTimeout("clickInputButton()",3000);

function clickInputButton () {
  document.getElementById('window.all.desktop.id_10.body.TCon1.btn_refresh').click()
}

This will call the button every 3 seconds.

Niek H.
  • 585
  • 1
  • 5
  • 19
  • Thanks, I go with that one! Comments must be at least 15 characters in length. (click on this box to dismiss) – Shlomo Mar 30 '12 at 13:09
1
var elem = document.getElementById("linkid");
if (typeof elem.onclick == "function") {
    elem.onclick.apply(elem);
}

stackoverflow.com:programmatically invoke an onclick() event

Community
  • 1
  • 1
Milindu Sanoj Kumarage
  • 2,714
  • 2
  • 31
  • 54
  • Thanks works! Comments must be at least 15 characters in length. (click on this box to dismiss) – Shlomo Mar 30 '12 at 13:08