Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
var button = document.createElement('button');
button.innerHTML = 'mylogin';
button.onclick = function(){ window.open("http://www.mysite.co.in");
};
var list =document.getElementById("divBoby").getElementsByTagName("table")[1];


list.insertBefore(button , list.childnodes);

What I have tried:

i not tried ,
how do i auto click "http://www.mysite.co.in" at sharp 9.30am by javascript
Posted
Updated 23-May-16 21:02pm

try like this

<script>

       var target = new Date();
       target.setHours(9, 30, 0, 0);
       function timer() {
           var now = new Date();
           if (target.getHours() == now.getHours() && target.getMinutes() == now.getMinutes()) {
               alert('9.30am task');
               // your code for button click
           }
           else {
               setTimeout(timer, 1000)
           }
       }

       timer();
       alert('timer started');

   </script>


refer Window setTimeout() Method
the above code is written for time delay for current day , if you need to repeat it for daily, then you will have to customize it.
 
Share this answer
 
Well, one way would seem to be, get the current time, work out how long 9.30AM is from now and set a timeout for that period of time. It's worth noting that it probably won't be 9.30 exactly that it triggers - it may be up to a couple of seconds later.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900