小编Jam*_*mie的帖子

从Chrome存储中获取多个项目?

我有4件我想要的东西,但我不确定如何分开钥匙.使用逗号会出错.以下是我的用法示例:

chrome.storage.sync.get({
    'customImage',
    'customColor',
    'customRandColor',
    'customRandImage'
  }, function(backgroundCheckedOptions) {
    document.getElementById('optionsCustomImage').checked = backgroundCheckedOptions.customImage;
    document.getElementById('optionsBackgroundColor').checked = backgroundCheckedOptions.customColor;
    document.getElementById('optionsRandomColor').checked = backgroundCheckedOptions.customRandColor;
    document.getElementById('optionsRandomImage').checked = backgroundCheckedOptions.customRandImage;
  });
Run Code Online (Sandbox Code Playgroud)

我原以为他们会用逗号分开,但我猜不是.

google-chrome-extension google-chrome-storage

9
推荐指数
1
解决办法
3570
查看次数

如何为"this".sibling设置文本修饰

我想在选中复选框时进行"直通"的文本修饰,并在未选中复选框时删除装饰.

这是我的js:

if ($(this).is(':checked')) {
    $(this).siblings('label').style.textDecoration = "line-through";
} else {
    $(this).siblings('label').style.textDecoration = "none";
}
Run Code Online (Sandbox Code Playgroud)

使用当前代码我得到的错误

未捕获的TypeError:无法设置未定义的属性'textDecoration'

而我认为这是因为它不喜欢我的this.siblings字符串.

javascript jquery

0
推荐指数
1
解决办法
515
查看次数

如何从网站获取苹果触摸图标,如果不存在则显示图标?

我想从网站上抓取苹果触摸图标(据我所知,大多数网站的图标都存储在website.com/apple-touch-icon.png),如果出现 404 或者图像不存在,则使用 Google 图标抓取器 ( https://plus.google.com/_/favicon?domain_url=google.com) 显示图标网站的。

用 js/jquery 可以吗?

javascript jquery

0
推荐指数
1
解决办法
1027
查看次数