有没有更快更优化的方法来实现这一点?
if (window.location.href.indexOf('/search/?') >= 0) {
if ($.cookie("Layout") == "Poster") {
$("link").attr("href", "../css/list.css");
} else if ($.cookie("Layout") == "Poster") {
$("link:first").attr("href", "css/list.css");
}
}
if (window.location.href.indexOf('/search/?') >= 0) {
if ($.cookie("Layout") == "Description") {
$("link").attr("href", "../css/desc.css");
} else if ($.cookie("Layout") == "Description") {
$("link:first").attr("href", "css/desc.css");
}
}