草庐IT

is_string

全部标签

javascript - jQuery + 扩展 Object.prototype = "c.replace is not a function"

我在我的开源项目中使用jQuery1.5,我自己的Javascript代码中也出现了以下行:/***Object.isEmpty()**@returns{Boolean}*/Object.prototype.isEmpty=function(){/***@deprecatedSinceJavascript1.8.5*@seehttps://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object*/if(this.__count__!==undefined){returnthis.__count__===0?

javascript - 如何解决错误 : "undefined is null or not object ie in ext js" in IE?

我认为这是尾随逗号或语法错误、未声明使用变量的原因。我的js字段是1000行od代码。由于错误没有向我提供行号。它变得难以调试。请帮助我调试IE的技术。该脚本适用于Firefox、Safari。 最佳答案 我会jslint文件。这会发现问题以及您可能遇到的任何其他问题。您可以将其作为commandlineutilityvianode运行. 关于javascript-如何解决错误:"undefinedisnullornotobjectieinextjs"inIE?,我们在StackOver

javascript - 为什么 String.prototype 的方法可用于字符串文字?

这个问题出自another,它涉及console.dir与字符串文字的行为。特别是,请参阅关于myanswer的评论.众所周知,JavaScript中的String对象有很多方法。这些方法在String.prototype对象上定义。String.prototype.toUpperCase例如。因此,我们可以这样做:vars=newString("hello"),s2=s.toUpperCase();//toUpperCaseisamethodonString.prototype不过,我们也可以这样做:vars="hello",//sisastringliteral,notaninst

javascript - 未捕获的 ReferenceError : (function) is not defined at HTMLButtonElement. onclick

我有一个搜索表单,我试图让它在页面底部输出结果而无需重新加载。TypeFirstName我希望在单击按钮时在下方显示搜索结果,使用Ajax调用另一个脚本。我不断收到错误消息:“未捕获的ReferenceError:搜索输出未在HTMLButtonElement.onclick中定义这是我的javascript(使用jquery):$(document).ready(function(){functionsearchoutput(){if($(".search-field").val().length>5){//onlyshowsresultswhenmorethan5character

javascript - "TypeError: this is not a typed array.with"Node.js 中的 WS.js

我的服务器文件中只有这个,出现错误:constWebSocket=require('ws');constwss=newWebSocket.Server({port:9000});wss.broadcast=functionbroadcast(data){wss.clients.forEach(functioneach(client){if(client.readyState===WebSocket.OPEN){client.send(data);}});};wss.on('connection',functionconnection(ws){ws.on('message',functi

javascript - 用 moment.js : Deprecation warning: value provided is not in a recognized RFC2822 or ISO format 排序

我使用Moment解析从API获得的日期,我需要在完成数据收集后对数组进行排序。我目前有这个:myobject.name=name;myobject.time=Moment(ajaxinfo.startdate).format('DD/MM/YYYY');array.push(myobject);//...moredataisadded...array.sort((left,right)=>{returnMoment.utc(left.time).diff(Moment.utc(right.time));});ajaxinfo.startdate是我从API获取的字符串,它看起来像"2

javascript - 逗号分隔值 : from strings to objects to list

我有3个变量,它们的字符串包含逗号分隔值(我不知道有多少),我想将它们合并到jQuery对象中。"name1,name2,name3,nameN""value1,value2,value3,valueN""id1,id2,id3,idN"到:varitem1={name:name1,value:value1,id:id1};varitem2={name:name2,value:value2,id:id2};varitem3={name:name3,value:value3,id:id3};varitemN={name:nameN,value:valueN,id:idN};然后对每个项目

javascript - 引用错误 : CKEDITOR is not defined

我正在尝试使用theCKeditor但是当我尝试thesample时出现以下错误(在JS控制台中)来自教程,只有一个文本框显示在浏览器中。ReferenceError:CKEDITORisnotdefined[BreakOnThisError]CKEDITOR.replace('editor1');/xampp/(line13)请注意,当我在mywebhosting上尝试时,示例有效.可以从浏览器访问文件ckeditor.js。 最佳答案 从/ckeditor/ckeditor.js中删除前导斜杠(因此尝试使用ckeditor/ck

javascript - jQuery.contents() 获取每个元素作为 HTML/STRING

我正在尝试使用jquery内容获取某些对象(包括文本)的HTML形式。这是我到目前为止得到的:HTMLtestfoobarjQuery$('#mydiv').contents().each(function(){console.log($(this).html());console.log($(this).prop("innerHTML"));console.log($(this).prop("outerHTML"));});有什么办法吗?我四处搜寻,但找不到任何东西。预先感谢您的回答! 最佳答案 如果您正在寻找包含包装元素的htm

javascript - 什么是 "string math",为什么不好?

我最近因为在我编写的应用程序中使用“字符串数学”而受到一位开发人员的斥责。我对整个开发过程还很陌生,没有接受过正规培训,也没有听说过这个问题。这是什么?有问题的代码:$('.submit-input').click(function(){varvalid=true;$('input,select,radio').removeClass('error');$('.error-message').hide();$('.validate').each(function(){if($(this).val()==$(this).attr('default')){valid=false;$(thi