這個(gè)問(wèn)題的答案可能很簡(jiǎn)單,但我找不到解決方案,因?yàn)橐磺兴坪醵己芎?。我正在嘗試創(chuàng)建一個(gè)谷歌瀏覽器擴(kuò)展,它有一個(gè)這樣的按鈕,document.getElementById("autof").addEventListener("click", autofill());function autofill() { console.log("ENTER"); document.getElementsByName("session[username_or_email]").value = "sylent"; document.getElementsByName("session[password]").value = "abcdefg";}<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <h1>TWITTER</h1> <button id="autof">Fill</button> <script src="twt.js"></script></body></html>
Javascript 按鈕在頁(yè)面加載時(shí)運(yùn)行一次點(diǎn)擊事件,點(diǎn)擊時(shí)不起作用
慕姐4208626
2022-12-09 17:10:19