Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
510 views
in Technique[技术] by (71.8m points)

settimeout - set timeout in javascript and do some condition on it

I write below code:

function bors(){document.getElementById('send_order_txtCount').value='140';
        document.getElementById('send_order_txtPrice').value='37,990';
        document.getElementById('send_order_btnSendOrder').click();
        document.getElementById('sendorder_ModalConfirm_btnSendOrder').click()}
        
var now = new Date();
var millisTill10 = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 8, 44, 0, 0) - now;
if (millisTill10 < 0) {
     millisTill10 += 86400000; // it's after 10am, try 10am tomorrow.
}
setTimeout(function(){var handle = setInterval(() => {bors()}, 500);

setTimeout(function(){clearInterval(handle)}, 120000)}, millisTill10);

but it returns a number like 3 , 4 , 5 and etc.

I want to do something in index of my country

I want to click on element in exact time to be front of the queue.

I want to register my click on 8:45:00:01 but i cant do that.

I can just do that on 8:45:00 but miliseconds is important

thanks for your helps.

question from:https://stackoverflow.com/questions/65948707/set-timeout-in-javascript-and-do-some-condition-on-it

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...