Css 是否使用userscript编辑img标记中的图像?
是否可以编辑Css 是否使用userscript编辑img标记中的图像?,css,userscripts,Css,Userscripts,是否可以编辑HTML属性,例如img标记中的图像,并使用用户脚本将图像切换到另一个图像?我只知道如何创建用户样式,而不知道如何创建用户脚本 这是我到目前为止尝试过的,但没有成功 // ==UserScript== // @name Steam* // @namespace http://userscripts.org/user/erraticfox // @description %description% // @include http://store.steamp
HTML属性
,例如img
标记中的图像,并使用用户脚本将图像切换到另一个图像?我只知道如何创建用户样式,而不知道如何创建用户脚本
这是我到目前为止尝试过的,但没有成功
// ==UserScript==
// @name Steam*
// @namespace http://userscripts.org/user/erraticfox
// @description %description%
// @include http://store.steampowered.com/
// @exclude %exclude%
// @version 1
// @grant none
// ==/UserScript==
document.getElementById('#logo_holder img').src = 'http://i.imgur.com/ytgtQME.png' !important;
假设您上述问题中的详细信息是正确的,那么以下内容应该可以根据需要进行操作
document.getElementById("logo_holder").src="http://i.imgur.com/ytgtQME.png";
@布罗卡达姆斯-更新了我的答案。