获取ID : $(this).attr("id");
:not用法
1. 列表用法
Issue 2091:window.resizeTo() doesn't have any effect

解决方案:
CSS to disable resizing textarea { resize: none; } <textarea <SPAN style="COLOR: #0000ff">name</SPAN>="<SPAN style="COLOR: #8b0000">foo</SPAN>"> textarea[<SPAN style="COLOR: #0000ff">name</SPAN>=foo] { resize: none; } HTML is <textarea id="<SPAN style="COLOR: #8b0000">foo</SPAN>">) #foo { resize: none; }登录后复制
http://www.brainjar.com/js/crunch/demo.html
缺点:
会把正则表达式中类似*/去除
Sample:
value = s.replace(/^0*/, '');
After Compress:
value = s.replace(/^0, '');
http://hi.baidu.com/iloverobot/blog/item/bd3ed651ffd362868c5430bf.html
http://blog.csdn.net/chinaontology/archive/2007/12/30/2004871.aspx
http://www.cnblogs.com/zengxiangzhan/archive/2010/01/14/1647866.html
http://code.google.com/p/chromium/issues/detail?id=115230
<SPAN style="COLOR: #800000">first</SPAN> <SPAN style="COLOR: #800000">of</SPAN> <SPAN style="COLOR: #800000">all</SPAN> <SPAN style="COLOR: #800000">sorry</SPAN> <SPAN style="COLOR: #800000">about</SPAN> <SPAN style="COLOR: #800000">my</SPAN> <SPAN style="COLOR: #800000">english</SPAN>, <SPAN style="COLOR: #800000">it</SPAN>'<SPAN style="COLOR: #800000">s</SPAN> <SPAN style="COLOR: #800000">not</SPAN> <SPAN style="COLOR: #800000">my</SPAN> <SPAN style="COLOR: #800000">native</SPAN> <SPAN style="COLOR: #800000">lengauge</SPAN>... <SPAN style="COLOR: #800000">i</SPAN> <SPAN style="COLOR: #800000">have</SPAN> <SPAN style="COLOR: #800000">a</SPAN> <SPAN style="COLOR: #800000">xml</SPAN> <SPAN style="COLOR: #800000">file</SPAN> <SPAN style="COLOR: #800000">that</SPAN> <SPAN style="COLOR: #800000">i</SPAN>'<SPAN style="COLOR: #800000">m</SPAN> <SPAN style="COLOR: #800000">reading</SPAN> <SPAN style="COLOR: #800000">with</SPAN> <SPAN style="COLOR: #800000">the</SPAN> <SPAN style="COLOR: #800000">sample</SPAN> <SPAN style="COLOR: #800000">code</SPAN> <SPAN style="COLOR: #800000">above</SPAN>...登录后复制<SPAN style="COLOR: #800000">but</SPAN> <SPAN style="COLOR: #800000">when</SPAN> <SPAN style="COLOR: #800000">i</SPAN> <SPAN style="COLOR: #800000">try</SPAN> <SPAN style="COLOR: #800000">to</SPAN> <SPAN style="COLOR: #800000">read</SPAN> <SPAN style="COLOR: #800000">it</SPAN> <SPAN style="COLOR: #800000">from</SPAN> <SPAN style="COLOR: #800000">a</SPAN> <SPAN style="COLOR: #800000">service</SPAN> <SPAN style="COLOR: #800000">web</SPAN> <SPAN style="COLOR: #800000">page</SPAN> (<SPAN style="COLOR: #800000"><A href="http://www.google.com/ig/api?weather=Buenos%20A">http</A></SPAN>://<SPAN style="COLOR: #800000">www</SPAN>.<SPAN style="COLOR: #800000">google</SPAN>.<SPAN style="COLOR: #800000">com</SPAN>/<SPAN style="COLOR: #800000">ig</SPAN>/<SPAN style="COLOR: #800000">api</SPAN>?<SPAN style="COLOR: #800000">weather</SPAN>=<SPAN style="COLOR: #800000">Buenos</SPAN>%<SPAN style="COLOR: #800000">20A</SPAN>...),登录后复制<SPAN style="COLOR: #800000">it</SPAN> <SPAN style="COLOR: #800000">doesn</SPAN>'<SPAN style="COLOR: #800000">t</SPAN> <SPAN style="COLOR: #800000">show</SPAN> <SPAN style="COLOR: #800000">anything</SPAN>... <SPAN style="COLOR: #800000">and</SPAN> <SPAN style="COLOR: #800000">if</SPAN> <SPAN style="COLOR: #800000">i</SPAN> <SPAN style="COLOR: #800000">write</SPAN> <SPAN style="COLOR: #800000">the</SPAN> <SPAN style="COLOR: #800000">same</SPAN> <SPAN style="COLOR: #800000">content</SPAN> <SPAN style="COLOR: #800000">of</SPAN> <SPAN style="COLOR: #800000">this</SPAN> <SPAN style="COLOR: #800000">page</SPAN> <SPAN style="COLOR: #800000">in</SPAN> <SPAN style="COLOR: #800000">a</SPAN> <SPAN style="COLOR: #800000">xml</SPAN> <SPAN style="COLOR: #800000">file</SPAN> <SPAN style="COLOR: #800000">in</SPAN> <SPAN style="COLOR: #800000">my</SPAN> <SPAN style="COLOR: #800000">pc</SPAN>,登录后复制
<SPAN style="COLOR: #800000">it</SPAN> <SPAN style="COLOR: #800000">works</SPAN> <SPAN style="COLOR: #800000">perfectly</SPAN>... <SPAN style="COLOR: #800000">i</SPAN> <SPAN style="COLOR: #800000">dont</SPAN> <SPAN style="COLOR: #800000">know</SPAN> <SPAN style="COLOR: #800000">what</SPAN> <SPAN style="COLOR: #800000">am</SPAN> <SPAN style="COLOR: #800000">i</SPAN> <SPAN style="COLOR: #800000">doing</SPAN> <SPAN style="COLOR: #800000">wrong</SPAN> <SPAN style="COLOR: #800000">i</SPAN> <SPAN style="COLOR: #800000">let</SPAN> <SPAN style="COLOR: #800000">u</SPAN> <SPAN style="COLOR: #800000">the</SPAN> <SPAN style="COLOR: #800000">code</SPAN> <SPAN style="COLOR: #800000">that</SPAN> <SPAN style="COLOR: #800000">i</SPAN>'<SPAN style="COLOR: #800000">m</SPAN> <SPAN style="COLOR: #800000">using</SPAN> <SPAN style="COLOR: #800000">maybe</SPAN> <SPAN style="COLOR: #800000">u</SPAN> <SPAN style="COLOR: #800000">could</SPAN> <SPAN style="COLOR: #800000">help</SPAN> <SPAN style="COLOR: #800000">me</SPAN> <SPAN style="COLOR: #800000">function</SPAN> <SPAN style="COLOR: #800000">clima</SPAN>(){ $.<SPAN style="COLOR: #ff0000">ajax</SPAN>(<SPAN style="COLOR: #0000ff">{ type: "GET", url: 'http://www.google.com/ig/api?weather=Buenos%20Aires', dataType: "xml", success: function(data){ var $weather = $(data).find('current_conditions') console.log($weather)</SPAN>; } }); } <SPAN style="COLOR: #800000">function</SPAN> <SPAN style="COLOR: #800000">clima</SPAN>() { $.<SPAN style="COLOR: #ff0000">ajax</SPAN>(<SPAN style="COLOR: #0000ff">{ type: "GET", dataType: "xml", url: 'http://www.google.com/ig/api?weather=Buenos%20Aires', success: function(xml) { var weather = $(xml).find("current_conditions").find("temp_c").attr("data")</SPAN>; <SPAN style="COLOR: #ff0000"> alert</SPAN>(<SPAN style="COLOR: #0000ff">"Prognostico para hoy: " + weather + " grados")</SPAN>; } }); }登录后复制
有关于$.ajaxSetup和$.get的问题
在Common.js中使用
$.ajaxSetup({ url: "<SPAN style="COLOR: #8b0000">…..</SPAN>", type: "<SPAN style="COLOR: #8b0000">POST</SPAN>", cache: <SPAN style="COLOR: #0000ff">true</SPAN>, dataType: "<SPAN style="COLOR: #8b0000">json</SPAN>" }); $.ajax({ data: { cityCode: cityCode, flag: flag }, success: <SPAN style="COLOR: #0000ff">function</SPAN>(areaList) { …} });登录后复制在PageA页面引入Common.js
然后在脚本段中使用 $.get(url);
此处url调用的是一个aspx页面,显示结果为无数据加载!(正常情况:有数据加载。)
然后经过使用IE8的开发人员工具,进行Trace Error.最终发现原因错误信息(如下)
"Invalid JSON:
那么如何解决呢?
原因:
肯定是请求数据类型有问题?
解决方案:
1.在Page A 页面脚本段 $.get(url,“html”);
因为$.get中的Data是可选项,现在确定原因之后,我们就来预定义好DataType
结果:OK
分析源由:
是因为$.ajaxSetup是用全局设定的,所以全局已经设定了DataType:JSON了。
那Page A 页面的$.get()肯定受及影响。
最终解决方案:
改Common.js,去掉ajaxSetup全局设定
$.ajax({ url: "…..", type: "POST", cache: true, dataType: "json",data: { cityCode: cityCode, flag: flag }, success: function(areaList) { …} });
结果:OK
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号