这是按钮:
<input type="submit" name="submitbutton" value=" black "><input>
我想将值“黑色”更改为“白色”,但我不能。如何用时尚改变价值?
您不能使用 CSS 更改按钮的值。虽然它可以使用 JavaScript 来完成。该链接可能会帮助您-
Stylish是一个附加组件/扩展,只允许您注入 CSS。该value
按钮的 是 JavaScript / DOM 属性;时尚无法改变这些。
您需要安装Greasemonkey (Firefox) 或Tampermonkey (Chrome)。
然后您可以运行此用户脚本来更改该值:
// ==UserScript==
// @name _YOUR_SCRIPT_NAME
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
var btn = document.querySelector ("input[name='submitbutton']");
if (btn) {
btn.value = "White";
}
else {
alert ("From GM script: Button not found");
}