我在我的应用程序中使用了角js。当我在IE浏览器上运行我的应用程序时,它会显示以下错误。
TypeError: Object doesn't support property or method 'includes'
at request (https://xxx.xx.xxx.com/js/app.js:32:20185)
at u (https://xxx.xx.xxx.com/js/base.js:5:30028)
at Anonymous function (https://xxxx.xx.xxxx.com/js/base.js:5:30210)
at
我刚刚使用以下命令安装了jQuery
npm install jquery
在使用Webpack将jquery,bootstrap合并到一个供应商文件中后,我一直收到以下错误
vendor.4b59d15129c2efa4408c.js:9979 Uncaught TypeError: url.indexOf is not a function
at jQuery.fn.init.jQuery.fn.load (vendor.4b59d15129c2efa4408c.js:9979)
at Object.<anonymous> (bundle.7beebbf8c43
我想用JS检查类名。但是,由于元素有几个类,使用的命令似乎无法工作。我怎样才能查到一个班呢?
HTML
<div class="first_class second_class third_class"> </div>
JS
var trg = e.target;
if ( trg.classList.contains('third_class') ) {
console.log(trg);
}
我在节目中有以下几行JS .
console.log(self.dataset[altAspect][altGroup] + " is the contents of the altGroup");
console.log(answer + " is the answer to be checked");
console.log('it is ' + (self.dataset[altAspect][altGroup].indexOf(answer) > -1) + &
我有一个类似于这样的html文件:
<html>
<head>
<css files>
<js files>
// maybe other things in header
</head>
<body>
// body contents ..
</body>
</html>
现在我想获得标题内容:
<css files>
<js files>
// maybe other things in header
怎么弄到这部分?
类似于:
string header = HTML
我有一个链接,当用户单击它时,它会将一个javascript文件推到页面上。除此之外,它还将参数添加到javascript src示例中:
<script type="text/javascript" src="javascripfile.js?r=some%values&u=more&values">
这不是通过浏览器上的URL传递的。我想知道如何在javascriptfile.js中获得这些参数?
javascriptfile.js
(function(){
//how to get r value, u value?
我有一个javascript函数如下:
if (',' in mpttexclusion){
$scope.exclusion = $scope.mpttexclusion.split(',');
} else {
$scope.exclusion = $scope.mpttexclusion;
}
但是,当我检查控制台时,我得到了以下错误:
TypeError: Cannot use 'in' operator to search for '
我们为我们的angular应用程序准备了启动和运行的karma测试套件。所有的测试都是绿色的。现在我必须修复IE 11失败的测试。我得到的异常如下:
TypeError: Object doesn't support this action
at createEventWithKeycode (http://localhost:9876/_karma_webpack_/main.bundle.js:3574:5)
at Anonymous function (http://localhost:9876/_karma_webpack_/main.bundle.
我想发送自定义尺寸通过我的GTM与谷歌分析。我试着遵循一个提供自定义JS的配方。然而,我得到了这个错误:
JavaScript编译器错误自定义js错误在第2行,字符20:解析错误。“)”期望的
我能做些什么来解决这个问题?
以下是代码:
// Pull activity type based on urlfunction
identifyActivity() {
var url = document.location.href, activityType = 'unknown';
if (url.indexOf('/pages/') > -1
我正在使用自定义javascript文件(mootools-1.2-core.js),在Sharepoint(2010)的自定义应用程序页面中,.I get 类型错配错误 in wpadder.js(Sharepoint Javascript文件,位于14/layouts中),有人为这个问题提供了解决方案吗?
以下简单代码片段的coffee-generated JS:
console.log 'b' if 'b' in arr
是
var __indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) return i;
} return -1;
};
if (__indexOf.call(arr, 'b') &g
下面的代码在Chrome中显示了一个错误。看起来window.location.href不返回字符串,但这看起来很疯狂。
代码如下:
var theUrl = "" + window.location.href;
var hashValue = theUrl.contains("#") ? theUrl.split('#')[1] : null; (This is line 6)
这将在Chrome中返回以下错误:
Uncaught TypeError: Object someUrl#someHash has no method 'con
我同时使用了browserify、吞咽和reactjs,
我有以下包含我的其他脚本的app.js;
var React = window.React = require('react');
var Signup = require('./ui/Signup');
var Login = require('./ui/Login');
`Signup.js
var React = require('react');
var signupNode = document.getElementById('signup');
我从本地存储得到了如下结果,
HD, TA, DI
现在,在角js中,我想将基于这些数据的div显示为:
HD : Only display Home Delivery Button.
HD, TA : Display Home Delivery and Take Away Buttons.
HD,TA,DI: Display Home Delivery, Take Away, dine In Buttons.
<div ng-if="result==What should be here"></div>
我正在寻找关于我实现方法的方法的任何建议(下面解释)。更具体地说,这是一个好做法还是不好的做法?如果没有,有什么建议吗?
注- communications.js在整个应用程序的许多地方使用。
Search_user.js
此代码搜索cookie,如果找到任何匹配项,则返回用户对象。
function searchForAUser () {
let userName = "userName=";
let userId = "userId=";
let user = {};
let decodedCookie = decodeURIComponent(docu
我想知道如何检测文本框是否不包含特定的单词。例如,如果文本框中没有包含“谁”、“什么”、“为什么”、“何时”或“何处”之类的函数。
JavaScript:
function command() {
var srchVar = document.getElementById("srch");
var srch = srchVar.value;
var t = srch;
if (srch == '') {
alert('Please do not leave the field empty!');