Uncaught TypeError: str.toLowerCase is not a function

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://lixuekai.blog.csdn.net/article/details/51445579

这个是在调试的时候遇到的,他们的都没问题,到我这就有问题了

问题在于,我在js代码里面使用了数据int类型的数据 ,他们的都是清一色的字符串,都没的问题。

然后如下图:


看到了,因为js时弱类型的,所以,它不知道你给他的是数字还是字符串,然后就出错了。


只需要在报错的字符串的前面给


str += ''; // 字符串化


然后就没事了。





展开阅读全文

Uncaught TypeError: $(...).jqGrid is not a function

01-22

$("#jqGridTableId").jqGrid(rn url : Eservice.ctx +'/ebiz/inquire/contNoShow.action?action=getPolicyList&ajax=true',rn mtype : 'POST',rn postData : rn heartStatus:$("#heartStatus").val(),rn contNo:$("#contNo").val(),rn riskCode:$("#riskCode").val(),rn planCode:$("#planCode").val(),rn channelName:$("#channelName").val(),rn productChannel:$("#productChannel").val(),rn name:$("#name").val(),rn paymentName:$("#paymentName").val(),rn bizeCode:$("#bizeCode").val()rn ,rn datatype : "xml",rn colNames : ['渠道代码', '订单号', '险种代码','款别',rn '投保人', '支付方式', '支付状态', '导入状态', '业务类型','操作'],rn colModel : [rn name : 'cont_no',rn index : 'cont_no',rn align : 'center',rn sortable : false,rn width: 90rn ,rn name : 'product_Channel',rn index : 'product_Channel',rn hidden : truern ,rn name : 'bize_code',rn index : 'bize_code',rn align : 'center',rn sortable : false,rn width: 90rn ,rn name : 'risk_code',rn index : 'risk_code',rn align : 'center',rn formatter : 'date',rn sortable : false,rn width: 55rn ,rn name : 'plan_code',rn index : 'plan_code',rn align : 'center',rn sortable : false,rn width: 120rn ,rn name : 'name',rn index : 'name',rn align : 'center',rn sortable : false,rn width: 55rn ,rn name : 'payment_name',rn index : 'payment_name',rn align : 'center',rn sortable : false,rn width: 50,rn formatter:function(val,rec) rn var cname;rn if(val=='1')rn cname="已支付";rn else if(val=='2')rn cname="未支付";rn else if(val=='3')rn cname="支付失败";rn rn return cname; rn rn ,rn name : 'heart_status',rn index : 'heart_status',rn align : 'center',rn sortable : false,rn width: 50 ,rn formatter:function(val,rec) rn var cname;rn if(val=='1')rn cname="已导入";rn else if(val=='2')rn cname="未导入";rn else if(val=='3')rn cname="导入失败";rn rn return cname; rn rn ,rn name : 'BIZE_CODE',rn index : 'BIZE_CODE',rn align : 'center',rn sortable : false,rn width: 75,rn formatter:function(val,rec) rn var cname;rn if(val=='101')rn cname="投保";rn else if(val=='102')rn cname="退保";rn else if(val=='103')rn cname="投保批改";rn else if(val=='104')rn cname="异步返回";rn else if(val=='105')rn cname="注销";rn rn return cname; rn rn ,rn name : 'oper',rn index : 'oper',rn align : 'center',rn sortable : false,rn width: 75rn ],rn shrinkToFit : true,rn rowNum : 10,rn rowList : [ 10, 30, 50 ],rn pager : '#jqGridPagerId',rn viewrecords : true,rn xmlReader : rn repeatitems : false,rn root : "object",rn row : "map",rn page : 'page',rn total : 'total',rn records : 'records'rn ,rn caption : "订单信息",rn height:'auto',rn gridComplete: function() //获得所有行的ID数组 rn var ids = $("#jqGridTableId").jqGrid('getDataIDs');rn var contNo=$('#contNo').val();rn for(var i=0;i < ids.length;i++) rn var arr = $("#jqGridTableId").jqGrid('getRowData',ids[i]);rn var linkReq = "" + arr.cont_no + "";rn $("#jqGridTableId").jqGrid('setRowData',ids[i],cont_no:linkReq);rn rn var linkHis = "" + 日志 + "";rn $("#jqGridTableId").jqGrid('setRowData',ids[i],oper:linkHis);rn var linkDetail = "" + 详情 + "";rn $("#jqGridTableId").jqGrid('setRowData',ids[i],oper:linkDetail);rn var linkDown = "" + 电子保单下载 + "";rn $("#jqGridTableId").jqGrid('setRowData',ids[i],oper:linkDown);rn rn rn );rnrn报:Uncaught TypeError: $(...).jqGrid is not a function错误,请各位大神指点 论坛

jquery中报Uncaught TypeError: pie is not a function

10-19

rnrn```rn $(function()rn var name = new Array();rn var value=new Array();rn var count = new Array();rn $.post(rn "BaseAction/SheetAction/ContributeSheetPie",rn function(data)rn rn name=data.name;rn value=data.value;rn pie(value,name);rn ,rn "json"rn );rn $('#show').click(function()rn var i=1;rn var pie=document.getElementById('pie');rn var bar=document.getElementById('bar');rn if(i==1)rn rn var count = new Array();rn pie.style.display="none";rn bar.style.display="block";rn $.post(rn "BaseAction/SheetAction/ContributeSheet",rn function(data)rn rn name=data.name;rn count=data.count;rn bar(name,count);//Uncaught TypeError: bar is not a functionrn ,rn "json"rn );rn i=0;rn rn if(i==0)rn rn pie.style.display="block";rn bar.style.display="none";rn $.post(rn "BaseAction/SheetAction/ContributeSheetPie",rn function(data)rn rn name=data.name;rn value=data.value;rn pie(value,name);//Uncaught TypeError: pie is not a functionrn ,rn "json"rn );rn rn rn );rn );rn //---------------------------pie饼形分析图--------------------------------------------------------------------------------rn function pie(value,name)rn rn // 路径配置rn require.config(rn paths: rn echarts: '<%=path%>/js/echarts/build/dist'rn rn );rn require(rn [rn 'echarts',rn 'echarts/chart/pie',rn 'echarts/chart/funnel'rn ],rn function (ec)rn rn // 基于准备好的dom,初始化echarts图表rn var myChart = ec.init(document.getElementById('pie'));rn var option = rn title :rn rn text: '顾客贡献',rn x:'center'rn ,rn tooltip :rn rn trigger: 'item',rn formatter: "a b : c (d%)"rn ,rn legend:rn rn orient : 'vertical',rn x : 'left',rn data:namern ,rn toolbox:rn rn show : true,rn feature :rn rn mark : show: true,rn dataView : show: true, readOnly: false,rn magicType :rn rn show: true,rn type: ['pie', 'funnel'],rn option:rn rn funnel:rn rn x: '25%',rn width: '50%',rn funnelAlign: 'left',rn max: 1548rn rn rn ,rn restore : show: true,rn saveAsImage : show: true,rn rn ,rn calculable : true,rn series :rn [rn rn name:"订单数",rn type:"pie",rn radius : '55%',rn center: ['50%', '60%'],rn data :valuern rn ]rn ;rn // 为echarts对象加载数据rn myChart.setOption(option);rn rn rn );rn ;rn //---------------------------pie饼形分析图--------------------------------------------------------------------------------rn function bar(name,count)rn rn // 路径配置rn require.config(rn paths: rn echarts: '<%=path%>/js/echarts/build/dist'rn rn );rn // 使用rn require(rn [rn 'echarts',rn // 使用柱状图就加载bar模块,按需加载rn 'echarts/chart/line',rn 'echarts/chart/bar'rn ],rn function (ec) rn // 基于准备好的dom,初始化echarts图表rn var myChart = ec.init(document.getElementById('bar'));rn var option = rn tooltip: rn trigger:'axis',rn ,rn legend: rn data:['贡献度']rn ,rn toolbox: rn show : true,rn feature : rn mark : show: true,rn dataView : show: true, readOnly: false,rn magicType : show: true, type: ['line', 'bar'],rn restore : show: true,rn saveAsImage : show: truern rn ,rn calculable : true,rn xAxis : [rn rn type : 'category',rn data : namern rn ],rn yAxis : [rn rn type : 'value'rn rn ],rn series : [rn rn "name":"订单数",rn "type":"bar",rn "data":count,rn markPoint : rn data : [rn type : 'max', name: '最大值',rn type : 'min', name: '最小值'rn ]rn ,rn markLine : rn data : [rn type : 'average', name: '平均值'rn ]rn rn rn ]rn ;rn // 为echarts对象加载数据rn myChart.setOption(option);rn rn );rn ;rn rn```rnrn 问答

求助啊 Uncaught TypeError: $(...).citySel is not a function

04-29

这个 错 折磨 我一天了 rn//设置下拉rn [code=javascript]rn$("#pcdAddress").citySel(rn prov:remote_ip_info['province'], //省份 rn city:remote_ip_info['city'], //市rn dist:remote_ip_info['district'], //街道rn nodata:"none" //当子集无数据时,隐藏select rn );[/code]rnrnrn[code=javascript]rn(function($)rn $.fn.citySel=function(settings)rn if(this.length<1)return;;rn rn // 默认值rn settings=$.extend(rn url:null,rn prov:null,rn city:null,rn dist:null,rn nodata:null,rn required:truern ,settings);rn rn var box_obj=this;rn var prov_obj=box_obj.find("#prov");rn var city_obj=box_obj.find("#city");rn var dist_obj=box_obj.find("#dist");rn var prov_val=settings.prov;rn var city_val=settings.city;rn var dist_val=settings.dist;rn var select_prehtml=(settings.required) ? "" : "请选择";rn var city_json;rn rn // 赋值市级函数rn var cityStart=function()rn var prov_id=prov_obj.get(0).selectedIndex;rn if(!settings.required)rn prov_id--;rn ;rn city_obj.empty().attr("disabled",true);rn dist_obj.empty().attr("disabled",true);rn rn if(prov_id<0||typeof(city_json.citylist[prov_id].c)=="undefined")rn if(settings.nodata=="none")rn city_obj.css("display","none");rn dist_obj.css("display","none");rn else if(settings.nodata=="hidden")rn city_obj.css("visibility","hidden");rn dist_obj.css("visibility","hidden");rn ;rn return;rn ;rn rn // 遍历赋值市级下拉列表rn temp_html=select_prehtml;rn $.each(city_json.citylist[prov_id].c,function(i,city)rn temp_html+=""+city.n+"";rn );rn city_obj.html(temp_html).attr("disabled",false).css("display":"","visibility":"");rn distStart();rn ;rn rn // 赋值地区(县)函数rn var distStart=function()rn var prov_id=prov_obj.get(0).selectedIndex;rn var city_id=city_obj.get(0).selectedIndex;rn if(!settings.required)rn prov_id--;rn city_id--;rn ;rn dist_obj.empty().attr("disabled",true);rn rn if(prov_id<0||city_id<0||typeof(city_json.citylist[prov_id].c[city_id].a)=="undefined")rn if(settings.nodata=="none")rn dist_obj.css("display","none");rn else if(settings.nodata=="hidden")rn dist_obj.css("visibility","hidden");rn ;rn return;rn ;rn rn // 遍历赋值市级下拉列表rn temp_html=select_prehtml;rn $.each(city_json.citylist[prov_id].c[city_id].a,function(i,dist)rn temp_html+=""+dist.s+"";rn );rn dist_obj.html(temp_html).attr("disabled",false).css("display":"","visibility":"");rn ;rn rn var init=function()rn // 遍历赋值省份下拉列表rn temp_html=select_prehtml;rn $.each(city_json.citylist,function(i,prov)rn temp_html+=""+prov.p+"";rn );rn prov_obj.html(temp_html);rn rn // 若有传入省份与市级的值,则选中。(setTimeout为兼容IE6而设置)rn setTimeout(function()rn if(settings.prov!=null)rn prov_obj.val(settings.prov);rn cityStart();rn setTimeout(function()rn if(settings.city!=null)rn city_obj.val(settings.city);rn distStart();rn setTimeout(function()rn if(settings.dist!=null)rn dist_obj.val(settings.dist);rn ;rn ,1);rn ;rn ,1);rn ;rn ,1);rn rn // 选择省份时发生事件rn prov_obj.bind("change",function()rn cityStart();rn );rn rn // 选择市级时发生事件rn city_obj.bind("change",function()rn distStart();rn );rn ;rn rn // 设置省市json数据rn if(typeof(settings.url)=="string")rn $.getJSON(settings.url,function(json)rn city_json=json;rn init();rn );rn elsern city_json=settings.url;rn init();rn ;rn ;rn )(jQuery);rn[/code] 论坛

TypeError: Ext.application is not a function错误怎么解决

10-24

问题来源:学习extjs5例子遇到的,网址[url=http://docs.sencha.com/extjs/5.0/getting_started/welcome_to_extjs.html]http://docs.sencha.com/extjs/5.0/getting_started/welcome_to_extjs.html[/url]。rnrnext5下载地址:[url=http://download.csdn.net/detail/sushengmiyan/7701943]http://download.csdn.net/detail/sushengmiyan/7701943[/url]rnrn问题步骤:第一步:下载extjs5,放置在本地,文件夹命名为ext5rn 第二步:在同级目录下,新建index.html 内容如下(仿照官方例子写的):rn[code=html]rnrn rn 欢迎来到 Ext JS!rn rn [color=#FF0000] [/color] rn rnrn rn rn rn[/code]rn 第三步:新建app.js 放在同级目录下,内容如下:rn[code=javascript]Ext.application(rn name : 'MyApp',rnrn launch : function() rnrn Ext.create('Ext.Panel', rn renderTo : Ext.getBody(),rn width : 200,rn height : 150,rn bodyPadding : 5,rn title : 'Hello World',rn html : 'Hello World...'rn );rnrn rn);[/code]rnrn这样运行,可以正常出现窗体。请注意,引入的是build目录下的ext-all.jsrn我现在想引入外部,build文件夹外的ext-all.jsrnrn现在改为rn[code=html]rnrn rn 欢迎来到 Ext JS!rn rn [color=#FF0000] [/color] rn rnrn rn rn rn[/code]rnrn就会报错[color=#FF0000]TypeError: Ext.application is not a function[/color]rn请问,这是为何呢,build下的是压缩过的吧,看起来也不方便啊,开发的话肯定是用压缩前的啊,有谁知道这是为啥么,虽然build下可以用,但是总觉得不舒服啊,我有强迫症啊。rnrn万分感谢啊 论坛

没有更多推荐了,返回首页