我在这段代码中卡住了几个小时,试图修改HTML的背景,以便它可以随着用户调整浏览器的大小而自动调整大小,我正在尝试通过javascript进行修改:(我在firefox btw中)
GM_addStyle('body {background-image: url("chrome://browserbackgrounds/content/browserbackgrounds
/Generic/Backgrounds/wall.jpg")}');
var images = document.getElementsByTagName ("img");
var x=0;
while(x<images.length)
{
if(images[x].src == "https://www.google.com/images/nav_logo170.png")
{
images[x].src = "chrome://browserbackgrounds/content/browserbackgrounds/Generic/Backgrounds
/wall.jpg";
}
x=x+1;
}下面是我被困住的部分
document.getElementById("gsr").style.MozBackgroundSize="Cover";
document.getElementById("gsr").style.WebkitBackgroundSize="Cover";
document.getElementById("gsr").style.OBackgroundSize="Cover";
document.getElementById("gsr").style.BackgroundSize="Cover";发布于 2013-11-19 08:31:25
你试过用backgroundSize吗?(请注意小写的初始b)。对于其余的属性也是如此,它们需要为camelCased。
https://stackoverflow.com/questions/20051089
复制相似问题