

<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>风名博客</title><link>https://blog.windname.com/</link><description>风名博客网</description><item><title>jquery之按年份 DESC 显示 google 图表日历</title><link>https://blog.windname.com/post/aejiji2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我正在使用 Google 日历图表，我想先显示 2015 年图表，然后显示 2014 年、2013 年等。 &lt;/p&gt; 
   &lt;p&gt;在谷歌的例子中:&lt;a href=&quot;https://developers.google.com/chart/interactive/docs/gallery/calendar&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;https://developers.google.com/chart/interactive/docs/gallery/calendar&lt;/a&gt;即使我按该顺序放置数据，也没有选项可以执行此操作。&lt;/p&gt; 
   &lt;p&gt;如何实现这一点？谢谢。&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;这并不是一个理想的解决方案，但如果您有兴趣，如果您愿意在数据中反转年份值，则可以手动反转图表中的年份值。就像这样:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;google.load(&quot;visualization&quot;, &quot;1.1&quot;, { 
  packages: [&quot;calendar&quot;] 
}); 
 
google.setOnLoadCallback(drawChart); 
 
function drawChart() { 
 
  var dataTable = new google.visualization.DataTable(); 
  dataTable.addColumn({type: 'date'}); 
  dataTable.addColumn({type: 'number'}); 
 
  dataTable.addRows([ 
    [new Date(2012, 1, 1), 1], 
    [new Date(2013, 1, 1), 2], 
    [new Date(2014, 1, 1), 3], 
    [new Date(2015, 1, 1), 4] 
  ]); 
 
  var chart = new google.visualization.Calendar(document.getElementById('calendar_basic')); 
  var options = {}; 
 
  google.visualization.events.addListener(chart, 'ready', swapYears); 
  chart.draw(dataTable, options); 
} 
 
// important code, this would be simpler w/ jQuery but here's pure JS 
function swapYears() { 
  var yearTexts = document.querySelectorAll('[font-size=&quot;50&quot;]'); 
 
  var years = []; 
  yearTexts.forEach(function(text) { 
    years.push(text.innerHTML); 
  }); 
  years.reverse(); 
 
  for (var i = 0; i &amp;lt; yearTexts.length; i++) { 
    yearTexts[i].innerHTML = years[i]; 
  } 
} 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt; &lt;a href=&quot;https://jsfiddle.net/40cvhekv/&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;JSFiddle&lt;/a&gt; &lt;/p&gt; 
   &lt;p&gt;输出:&lt;/p&gt; 
   &lt;p&gt; &lt;a href=&quot;/image/iCNTv.png&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;&lt;span sd=&quot;/image/iCNTv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/span&gt;&lt;/a&gt; &lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>jquery之定义何时触发 onclick</title><link>https://blog.windname.com/post/aejijh2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我遇到了一些小问题。我有一个表单，并且我在系统中映射表单的字段。表单的按钮会自动获得一个像这样的 onclick 事件&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;window.location='http://www.something.com/test.html?vs=ZWJhMDAzMzktMTNkYi00ODRkLTgxYmQtNjQwYTU5MDIyZWE3OzA6ODc5NjY2NzoxMjg2NzUyNDM3NDI6OTAxNzM0MzA1OjkwMTczNDMwNTsS1' 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;它添加了一个需要的 vs 变量。问题是我需要表单有一个输入类型按钮，而不是提交。我正在使用 JQuery 验证，并且我用它来触发表单提交&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;$(&quot;#btn-default2&quot;).click(function() { 
        $(&quot;#myform&quot;).submit(); 
    }); 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;现在的问题是，由于 onclick 事件，验证会快速触发，然后 onclick 事件会进行重定向。如果表单有效，我只需要此重定向。有什么方法可以停止 onclick 事件，并将其移至我的函数中，在其中检查表单是否有效？&lt;/p&gt; 
   &lt;p&gt;谢谢&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;针对您的问题的程序性解答，&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;var btn = $(&quot;button.validate&quot;); 
var x = btn.attr(&quot;onclick&quot;); //get the onclick and store it in a variable. 
btn.attr(&quot;onclick&quot;, &quot;&quot;); //remove the onclick attribute for that button 
btn.click(function() { 
    //Now do validations for your button. 
    if ($(&quot;input[type='text']&quot;).val() == &quot;10&quot;) {  
        eval(x); //If the form fields passed the validation 
        //then trigger the redirect using eval 
    } 
}); 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;h2&gt; &lt;a href=&quot;https://jsfiddle.net/h2dhevcc/1/&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;DEMO&lt;/a&gt; &lt;/h2&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>jquery之如何将 Semantic-UI 导入 Angular 项目</title><link>https://blog.windname.com/post/aejijg2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我正在开发一个基于 Semantic-UI 框架(这是 Semantic-UI 的一个分支)的 Angular 项目。&lt;/p&gt; 
   &lt;p&gt;我已经安装了:&lt;/p&gt; 
   &lt;p&gt; &lt;code&gt;npm install --save fomantic-ui&lt;/code&gt; &lt;/p&gt; 
   &lt;p&gt;然后我在 &lt;code&gt;angular.json&lt;/code&gt; 中添加了以下几行文件:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;&quot;styles&quot;: [ 
    &quot;node_modules/fomantic-ui/dist/semantic.min.css&quot;, 
    &quot;src/styles.scss&quot; 
], 
&quot;scripts&quot;: [ 
    &quot;node_modules/jquery/dist/jquery.min.js&quot;, 
    &quot;node_modules/fomantic-ui/dist/semantic.min.js&quot; 
] 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;我还为它安装了类型 &lt;code&gt;npm install --save @types/semantic-ui&lt;/code&gt;并且，根据&lt;a href=&quot;https://github.com/fomantic/Fomantic-UI/issues/1205&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;this&lt;/a&gt; ，它们应该可以与 Semantic-UI 一起正常工作。&lt;/p&gt; 
   &lt;p&gt;无论如何，这似乎不足以使用 &lt;code&gt;modal()&lt;/code&gt; 等函数。 , &lt;code&gt;dropdown()&lt;/code&gt; , &lt;code&gt;calendar()&lt;/code&gt; ，事实上，我在 IDE (Webstorm) 和编译过程中都遇到错误:&lt;/p&gt; 
   &lt;p&gt; &lt;code&gt;TS2339: Property 'modal' does not exist on type 'JQuery&amp;lt;HTMLElement&amp;gt;'.&lt;/code&gt; &lt;/p&gt; 
   &lt;p&gt; &lt;code&gt;TS2339: Property 'calendar' does not exist on type 'JQuery&amp;lt;any&amp;gt;'.&lt;/code&gt; &lt;/p&gt; 
   &lt;p&gt; &lt;code&gt;TS2339: Property 'dropdown' does not exist on type 'JQuery&amp;lt;HTMLElement&amp;gt;'.&lt;/code&gt; &lt;/p&gt; 
   &lt;p&gt;等等...&lt;/p&gt; 
   &lt;p&gt;你知道在我的项目中导入 Semantic-UI 的正确方法是什么吗？&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;对于 Typescript 类型，您需要在 tsconfig.json 文件中添加一些行，以向 Angular 应用程序声明这些类型。 &lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;{ 
  &quot;compilerOptions&quot;: { 
    ... 
    &quot;target&quot;: &quot;es5&quot;, 
    &quot;typeRoots&quot;: [ 
      &quot;../node_modules/@types&quot; 
    ], 
    &quot;types&quot;: [ 
      &quot;hammerjs&quot;, 
      &quot;jasmine&quot;, 
      &quot;semantic-ui&quot; 
    ], 
    ... 
} 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;也在 &lt;code&gt;tsconfig.app.json&lt;/code&gt; 中:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;{ 
  &quot;extends&quot;: &quot;./tsconfig.json&quot;, 
  &quot;compilerOptions&quot;: { 
    &quot;outDir&quot;: &quot;./out-tsc/app&quot;, 
    &quot;types&quot;: [ 
      &quot;semantic-ui&quot; 
    ] 
  }, 
  ... 
} 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;测试文件中相同&lt;code&gt;tsconfig.spec.json&lt;/code&gt;:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;{ 
  &quot;extends&quot;: &quot;./tsconfig.json&quot;, 
  &quot;compilerOptions&quot;: { 
    &quot;outDir&quot;: &quot;../out-tsc/spec&quot;, 
    &quot;types&quot;: [ 
      &quot;jasmine&quot;, 
      &quot;node&quot;, 
      &quot;semantic-ui&quot; 
    ] 
  }, 
  ... 
} 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>jquery之使用 jQuery 或 Javascript 写入本地文件</title><link>https://blog.windname.com/post/aejijf2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我正在创建一个将在网络浏览器中运行的原型(prototype)。我想存储(和检索)用户在使用原型(prototype)期间提交的各种信息。我知道我可以检索各种文件格式，例如 xml、json...并且我知道我可以使用插件 jstore 进行本地存储。所以我想我可以做一个复杂的解决方案，从启动文件中获取第一个 xml 加载，然后在操作它后使用本地存储，然后检查本地存储。&lt;/p&gt; 
   &lt;p&gt;我不想使用 PHP 或 ASP 或其他脚本，因为我需要能够与不会运行网络服务器的高级管理人员共享原型(prototype)，并且我不想在网络服务器上安装原型(prototype)...但是也许这是最好的方法，因为我知道出于安全原因，javascript 无法写入本地文件系统。另一方面，也许我正在使获取初始 xml 和使用 jstore 插件的组合听起来比实际更困难。&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;该网络平台专门设计用于防止网站将任意数据写入客户端计算机。您可以探索一些异常(exception)情况:&lt;/p&gt; 
   &lt;ul&gt; 
    &lt;li&gt;像 Google Gears 这样的插件；或 HTML5 中的数据存储(未广泛使用)(容易丢失)&lt;/li&gt; 
    &lt;li&gt;Cookie(容易丢失)&lt;/li&gt; 
    &lt;li&gt;URL(受长度限制，容易丢失)&lt;/li&gt; 
    &lt;li&gt;文件(更传统但笨拙)&lt;/li&gt; 
   &lt;/ul&gt; 
   &lt;p&gt;网络显然通过服务器运行得更好。如果您希望部署桌面安装，则可以部署使用大量基于浏览器的 UI 的厚应用程序。该应用程序可以轻松访问本地系统的文件等。如果可能，请发表评论。&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>Jquery ui 可排序序列化不起作用</title><link>https://blog.windname.com/post/aejije2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;查遍了也没找到答案。我无法让我的可排序序列化。我得到的只是空数据&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;$(document).ready(function() { 
    $(&quot;ul#sortable&quot;).sortable({ 
        update : function () { 
            serial = $(&quot;ul#sortable&quot;).sortable(&quot;serialize&quot;); 
            $.ajax({ 
                url: &quot;sort_images_ajax.php&quot;, 
                type: &quot;post&quot;, 
                data: serial, 
                error: function(){ 
                    alert(&quot;theres an error with AJAX&quot;); 
                }, 
                success: function(feedback){ $(&quot;#data&quot;).html(feedback); } 
            }); 
        } 
 
    }); 
}); 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;这是我的 html:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;&amp;lt;ul id=&quot;sortable&quot;&amp;gt; 
&amp;lt;li id=&quot;sort_1&quot; class=&quot;ui-state-default&quot;&amp;gt;1&amp;lt;/li&amp;gt; 
&amp;lt;li id=&quot;sort_2&quot; class=&quot;ui-state-default&quot;&amp;gt;2&amp;lt;/li&amp;gt; 
&amp;lt;li id=&quot;sort_3&quot; class=&quot;ui-state-default&quot;&amp;gt;3&amp;lt;/li&amp;gt; 
&amp;lt;/ul&amp;gt; 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;由于我使用的是 jquery 1.4.2，所以我在 Stack Overflow 上找到了这条信息:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;jQuery.ajaxSettings.traditional = true; 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;无论有没有最后一段代码，我都无法将其序列化。有什么建议吗？&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我也有同样的问题...显然，从事件处理函数中调用 .sortable() 方法不起作用？!&lt;/p&gt; 
   &lt;p&gt;P.S.:我认为您应该使用“停止”事件，而不是“更新”。&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>JQuery UI 可排序在 IE8 中很慢，但在 IE7 和 IE8 兼容模式下运行良好</title><link>https://blog.windname.com/post/aejijd2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;JQuery UI 可排序(包括演示)在我可以测试的所有 IE8 中都很慢，但在 IE7 和 IE8 兼容模式下运行顺利。页面上的标记越复杂，IE8 的速度就越慢(这是我可以理解的，DOM 树变得更复杂)。&lt;/p&gt; 
   &lt;p&gt;我正在使用 JQuery 1.3.2 和 JQuery UI 1.7.2(使用 1.7.3 进行测试 - 相同的情况)。&lt;/p&gt; 
   &lt;p&gt;我发现了很多类似的报告(也适用于新的 JQuery UI 1.8.x 和 JQuery 1.4)，但没有答案。&lt;/p&gt; 
   &lt;p&gt;可能有一些解决方案(除了通过元标记或 header 将 IE8 转换为 IE7 兼容模式)。提前致谢!&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我确信您现在已经找到了一些解决方案，但以防万一其他人正在阅读本文。我认为答案是升级到 jQuery 1.4 和 jQuery UI 1.8。它们比前辈要快得多。&lt;/p&gt; 
   &lt;p&gt;对于依赖 jQuery 1.3 的网站，您可以升级到 1.4 并使用向后兼容插件:&lt;/p&gt; 
   &lt;p&gt; &lt;a href=&quot;https://github.com/jquery/jquery-compat-1.3&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;https://github.com/jquery/jquery-compat-1.3&lt;/a&gt; &lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>jquery ui按钮不一致的悬停状态</title><link>https://blog.windname.com/post/aejijc2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我有 4 个使用 Jquery UI 的“按钮”功能的按钮。 3 工作完美无缺。第四个似乎不想在悬停时始终应用 jquery ui 悬停类“ui-state-hover”。它有时会这样做，但大多数时候它只应用“悬停”类(我在 firebug 中观看它)，这显然与它们的 css 样式不匹配。有谁知道到底是什么原因导致了这种差异？&lt;/p&gt; 
   &lt;p&gt;编辑:我认为这是 UI 按钮和 Ajax uploader 之间的冲突。这是我正在使用的一些精简代码。&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;$('.upload_img').button({ 
    icons: { 
        primary: 'ui-icon-folder-open' 
    }, 
    label: &quot;Browse&quot; 
    }) 
 
 
 
 
 
   jQuery('.upload_img').each(function(){ 
 
    var button = jQuery(this); 
    var ID = jQuery(this).attr('value'); 
    var container = jQuery(this).parent(); 
 
    //prevent the clicks from its default 'form submit' behavior 
    $(this).click(function() { 
    return false; 
    });              
 
    new AjaxUpload( button, { 
        action: ajaxurl, 
        name: ID , // File upload name 
        data: { // Additional data to send 
            action: 'save_function', 
            type: 'upload', 
            _nonce: '&amp;lt;?php echo $nonce; ?&amp;gt;', 
            key: ID }, 
        onSubmit: function(file , ext){ 
            this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button 
 
        }, 
        onComplete: function(file, response) { 
            this.enable(); // re-enable upload button 
 
            if(response == 99){ 
                //alert(response); 
                show_message(5); // failure 
                t = setTimeout('fade_message()', 2000); 
            } 
            // If there was not an error 
            else{    
 
                show_message(4); // success 
                t = setTimeout('fade_message()', 2000); 
 
                } 
        } 
    }); 
 
 
 
 
    }); 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;重新启用后，您是否尝试将 &lt;code&gt;.button&lt;/code&gt; 重新附加到 &lt;code&gt;.upload_img&lt;/code&gt; 上？&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>jquery之使用 jquery 将文本框转换为多行</title><link>https://blog.windname.com/post/aejijb2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我有一个单行文本框。&lt;/p&gt; 
   &lt;p&gt;我想用 jquery 将其转换为多行，但控制添加到其中的行数。我还希望能够限制每行的字符数。&lt;/p&gt; 
   &lt;p&gt;有什么想法可以用 jquery 做到这一点吗？&lt;/p&gt; 
   &lt;p&gt;编辑:&lt;/p&gt; 
   &lt;p&gt;是的，我所说的文本框是 &lt;code&gt;&amp;lt;input type=&quot;text&quot;&amp;gt;&lt;/code&gt; &lt;/p&gt; 
   &lt;p&gt;EG。 &lt;code&gt;&amp;lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;txtTextBox1&quot; id=&quot;xtTextBox1&quot;&amp;gt;&lt;/code&gt; &lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;考虑到您有以下 HTML:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;text&quot; class=&quot;myclasses&quot; style=&quot;color: #123123&quot; value=&quot;akira&quot;/&amp;gt;  
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;然后使用以下代码片段:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;(function($) { 
    $.fn.changeToTextArea = function(rows, columns) { 
        var attrs = {}; 
        var text = &quot;&quot;; 
 
        $.each(this[0].attributes, function(idx, attr) { 
            attrs[attr.nodeName] = attr.nodeValue; 
            if(attr.nodeName == &quot;value&quot;) { 
              text = attr.nodeValue; 
              } 
            attrs[&quot;rows&quot;] = rows; 
            attrs[&quot;cols&quot;] = columns; 
        }); 
 
        this.replaceWith(function() { 
            return $(&quot;&amp;lt;textarea/&amp;gt;&quot;, attrs).append($(this).contents()).html(text); 
        }); 
    } 
})(jQuery); 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;你应该用&lt;/p&gt;来调用它 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;$(&quot;input&quot;).changeToTextArea(7, 25); 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;div class=&quot;snippet&quot; data-lang=&quot;js&quot; data-hide=&quot;false&quot; data-console=&quot;true&quot; data-babel=&quot;false&quot;&gt; 
    &lt;div class=&quot;snippet-code&quot;&gt; 
     &lt;pre class=&quot;snippet-code-js lang-js prettyprint-override&quot;&gt;&lt;code&gt;(function($) { 
    $.fn.changeToTextArea = function(rows, columns) { 
        var attrs = {}; 
        var text = &quot;&quot;; 
       
        $.each(this[0].attributes, function(idx, attr) { 
            attrs[attr.nodeName] = attr.nodeValue; 
            if(attr.nodeName == &quot;value&quot;) { 
              text = attr.nodeValue; 
              } 
            attrs[&quot;rows&quot;] = rows; 
            attrs[&quot;cols&quot;] = columns; 
        }); 
 
        this.replaceWith(function() { 
            return $(&quot;&amp;lt;textarea/&amp;gt;&quot;, attrs).append($(this).contents()).html(text); 
        }); 
    } 
})(jQuery); 
 
 
$(&quot;input&quot;).changeToTextArea(7, 25);&lt;/code&gt;&lt;/pre&gt; 
     &lt;pre class=&quot;snippet-code-html lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; 
&amp;lt;input type=&quot;text&quot; class=&quot;xyzxterms&quot; style=&quot;color: #123131&quot; value=&quot;akira&quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt; 
    &lt;/div&gt; 
   &lt;/div&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>jquery之从 Prototype 迁移到 jQuery (Rails) 的策略</title><link>https://blog.windname.com/post/aejija2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;我有一个现有的 Rails 应用程序，其中包含使用 &lt;strong&gt;Prototype&lt;/strong&gt; 编写的大量 &lt;code&gt;js&lt;/code&gt; 代码，我希望将 &lt;strong&gt;jQuery&lt;/strong&gt; 设置为默认应用程序的 javascript 框架，并且然后将现有的 &lt;strong&gt;Prototype&lt;/strong&gt; 代码迁移到 &lt;strong&gt;jQuery&lt;/strong&gt; 的等效代码。 &lt;/p&gt; 
   &lt;p&gt;您对此类问题的经验是什么，或者您建议我采取什么策略，以使其尽可能轻松:P。 &lt;/p&gt; 
   &lt;p&gt;任何帮助将不胜感激，提前致谢。&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;查看以下链接 - &lt;/p&gt; 
   &lt;p&gt; &lt;a href=&quot;http://randomactsofcoding.blogspot.com/2008/09/migrating-to-jquery.html&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;http://randomactsofcoding.blogspot.com/2008/09/migrating-to-jquery.html&lt;/a&gt; &lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item><item><title>javascript之点击后退按钮时是否存在跨浏览器onload事件</title><link>https://blog.windname.com/post/aejijj2b1.html</link><description>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
  &lt;div id=&quot;question&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;对于所有主要浏览器(IE 除外)，当由于后退按钮操作而加载页面时，JavaScript &lt;code&gt;onload&lt;/code&gt; 事件不会触发 - 它仅在页面首次加载时触发。 &lt;/p&gt; 
   &lt;p&gt;有人能给我一些解决这个问题的示例跨浏览器代码(Firefox、Opera、Safari、IE...)吗？我熟悉 Firefox 的 &lt;code&gt;pageshow&lt;/code&gt; 事件，但不幸的是 Opera 和 Safari 都没有实现此功能。&lt;/p&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px;&quot;&gt; 
   &lt;p&gt; &lt;strong&gt;&lt;font size=&quot;5&quot;&gt;请您参考如下方法:&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div id=&quot;answer&quot;&gt; 
   &lt;p&gt;&lt;/p&gt; 
   &lt;p&gt;各位，我发现JQuery只有一个作用:按下后退按钮时重新加载页面。这与“&lt;strong&gt;准备就绪&lt;/strong&gt;”无关。&lt;/p&gt; 
   &lt;p&gt;这是如何工作的？好吧，JQuery 添加了一个 &lt;strong&gt;onunload&lt;/strong&gt; 事件监听器。&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;// http://code.jquery.com/jquery-latest.js 
jQuery(window).bind(&quot;unload&quot;, function() { // ... 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;默认情况下，它不执行任何操作。但不知何故，这似乎会触发 Safari、Opera 和 Mozilla 中的重新加载——无论事件处理程序包含什么。&lt;/p&gt; 
   &lt;p&gt;[&lt;em&gt;编辑(Nickolay)&lt;/em&gt;:这就是为什么它会这样工作:&lt;a href=&quot;http://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;webkit.org&lt;/a&gt; , &lt;a href=&quot;https://developer.mozilla.org/En/Using_Firefox_1.5_caching&quot; rel=&quot;noreferrer noopener nofollow&quot;&gt;developer.mozilla.org&lt;/a&gt; 。请阅读这些文章(或我在下面的单独答案中的总结)，并考虑您是否真的需要这样做并让您的用户的页面加载速度变慢。]&lt;/p&gt; 
   &lt;p&gt;不敢相信？试试这个:&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;&amp;lt;body onunload=&quot;&quot;&amp;gt;&amp;lt;!-- This does the trick --&amp;gt; 
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt; 
    alert('first load / reload'); 
    window.onload = function(){alert('onload')}; 
&amp;lt;/script&amp;gt; 
&amp;lt;a href=&quot;http://stackoverflow.com&quot;&amp;gt;click me, then press the back button&amp;lt;/a&amp;gt; 
&amp;lt;/body&amp;gt; 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;使用 JQuery 时您会看到类似的结果。&lt;/p&gt; 
   &lt;p&gt;您可能想与没有 &lt;strong&gt;onunload&lt;/strong&gt; 的这个进行比较&lt;/p&gt; 
   &lt;pre class=&quot;prism-language-java&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;&amp;lt;!-- Will not reload on back button --&amp;gt; 
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt; 
    alert('first load / reload'); 
    window.onload = function(){alert('onload')}; 
&amp;lt;/script&amp;gt; 
&amp;lt;a href=&quot;http://stackoverflow.com&quot;&amp;gt;click me, then press the back button&amp;lt;/a&amp;gt; 
&amp;lt;/body&amp;gt; 
&lt;/code&gt;&lt;/pre&gt; 
   &lt;p&gt;&lt;/p&gt; 
  &lt;/div&gt; 
  &lt;div style=&quot;margin-top: 20px; margin-bottom: 40px;&quot;&gt;  
  &lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;&lt;br&gt;</description><pubDate>Thu, 29 Oct 2026 21:34:24 +0800</pubDate></item></channel></rss><!--40.30 ms , 6 query , 1644kb memory , 4 error-->