【发布时间】:2016-01-07 03:20:24
【问题描述】:
我有以下脚本
$('#copyright, #credit, #doom a').each(function () {
if ($(this).css('font-size') != '15px') {
document.location.href = "http://www.example.com";
}
});
它检查所有这些 ID 的 CSS 属性是否为 font-size 15px;如果不是 15px,那么页面将被重定向到 example.com。
我想知道如何在该脚本中添加多个 CSS 属性。我想加入position:relative;height:auto;background:#000;。
它可能看起来像这样:(这只是示例,不是工作脚本)
$('#copyright, #credit, #doom a').each(function () {
if
position:relative;height:auto;background:#000
{ do nothing }
else
{
document.location.href = "http://www.example.com";
}
});
【问题讨论】:
标签: javascript jquery html redirect url-redirection