啊!我的网站在Chrome中被破坏了.
在控制台中获取此消息: Uncaught DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': Cannot access StyleSheet to insertRule
它指向这行代码,它来自第三方插件:
document.styleSheets[0].insertRule(rule,0);
Run Code Online (Sandbox Code Playgroud)
样式表在头部定义:
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:300,400,700">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="/Public/js/jquery-ui/jquery-ui.css" />
<link type="text/css" rel="stylesheet" href="/Public/js/jquery-ui/jquery-ui.theme.min.css" />
<link type="text/css" rel="stylesheet" href="/Public/css/msgPop.css" />
<link type="text/css" rel="stylesheet" href="/Public/js/select2/select2.css">
Run Code Online (Sandbox Code Playgroud) 如何使用它的ID但使用widcard选择div?
如果是DIV的ID statusMessage_1098
,我想以某种方式选择它document.getElementById('statusMessage_*')
.
这是因为在生成页面之前,我不知道ID的后缀,并且页面中只会出现一个这样的ID.这可能吗?
谢谢你的帮助.
以下是我的JS代码:
window.location.href = 'products.php?price_range=-INFto2000,2001to5000';
Run Code Online (Sandbox Code Playgroud)
我的问题是如何在 javascript 中对 URL 进行编码并在 PHP 中对其进行解码,这样我的浏览器的导航栏就会显示
“products.php?price_range=-INFto2000%2C2001to5000”
代替
“products.php?price_range=-INFto2000,2001to5000”
我的 php 代码将能够使用-INFto2000,2001to5000
in的正确值$_GET['price_range']