我正在使用 Squarepace。
我正在尝试更改“身份验证”一词 here
这是脚本:
document.title = "McCann Show & Tell - Please enter the password :)";
document.body.style.background = "#f7a2cc url('https://dl.dropboxusercontent.com/u/46025079/pattern.jpg') repeat";
document.addEventListener('DOMContentLoaded', function() {
document.getElementById("yui_3_17_2_1_1418836557893_299").value = "hello";
}, false);
这是尝试更改按钮文本的部分
document.addEventListener('DOMContentLoaded', function() {
document.getElementById("yui_3_17_2_1_1418836557893_299").value = "hello";
}, false);
我似乎无法让它工作
最佳答案
该按钮的 id
不断变化,因此您需要使用不同的选择器。
您可以尝试:
document.querySelectorAll('input[type=button]')[0].value = 'hello';
或
document.getElementsByClassName('saveAndClose')[0].value = 'hello';
关于javascript - 通过JS改变按钮文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27531492/