Javascript 通过JS更改按钮文本?

Javascript 通过JS更改按钮文本?,javascript,squarespace,Javascript,Squarespace,我用的是平方空间 我正在尝试更改“身份验证”一词 以下是脚本: 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('D

我用的是平方空间

我正在尝试更改“身份验证”一词

以下是脚本:

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';


我认为按钮
id
经常变化。所以你不能相信这一点。
document.getElementsByClassName('saveAndClose')[0].value = 'hello';