嗨,我是新手,非常业余。我想用grasemonkey脚本更改airdroid网页的背景壁纸,但我失败了。我找到了时尚的剧本,但我想要grasemonkey。这是airdroid网页代码的背景壁纸;
<div id="block-wallpaper" origin="http://cdn1.airdroid.com/V2121406161807/theme/stock/images/wallpaper/default.jpg" class="type-scale">
<img class="stock" src="http://cdn1.airdroid.com/V2121406161807/theme/stock/images/wallpaper/default.jpg">
<div class="bg" style=""></div>
</div>
请帮助我:(
答案 0 :(得分:1)
试试这个作为你的油脂单脚本的主体:
$(document).ready(function() {
$('#block-wallpaper > img').attr('src', 'http://your-image-url' )
})
答案 1 :(得分:0)
我想如下:
setTimeout(function() {
var images = document.getElementsByTagName('img');
for (i=0; i<images.length; i++)
{
if(images[i].src == "http://cdn1.airdroid.com/V2121406161807/theme/stock/images/wallpaper/default.jpg")
{
images[i].src = "http://wallpapers.wallbase.cc/rozne/wallpaper-2628182.jpg";
}
i=i+1;
} }, 600);
答案 2 :(得分:-1)
$('img.stock').attr('src','[url to img]');