<bdo id='WYT6Y'></bdo><ul id='WYT6Y'></ul>
    1. <legend id='WYT6Y'><style id='WYT6Y'><dir id='WYT6Y'><q id='WYT6Y'></q></dir></style></legend>

      <tfoot id='WYT6Y'></tfoot>

        <i id='WYT6Y'><tr id='WYT6Y'><dt id='WYT6Y'><q id='WYT6Y'><span id='WYT6Y'><b id='WYT6Y'><form id='WYT6Y'><ins id='WYT6Y'></ins><ul id='WYT6Y'></ul><sub id='WYT6Y'></sub></form><legend id='WYT6Y'></legend><bdo id='WYT6Y'><pre id='WYT6Y'><center id='WYT6Y'></center></pre></bdo></b><th id='WYT6Y'></th></span></q></dt></tr></i><div id='WYT6Y'><tfoot id='WYT6Y'></tfoot><dl id='WYT6Y'><fieldset id='WYT6Y'></fieldset></dl></div>

        <small id='WYT6Y'></small><noframes id='WYT6Y'>

        JSFiddle包装在onLoad中?

        时间:2023-06-14
            <tbody id='TOy2T'></tbody>
          • <bdo id='TOy2T'></bdo><ul id='TOy2T'></ul>
          • <small id='TOy2T'></small><noframes id='TOy2T'>

          • <i id='TOy2T'><tr id='TOy2T'><dt id='TOy2T'><q id='TOy2T'><span id='TOy2T'><b id='TOy2T'><form id='TOy2T'><ins id='TOy2T'></ins><ul id='TOy2T'></ul><sub id='TOy2T'></sub></form><legend id='TOy2T'></legend><bdo id='TOy2T'><pre id='TOy2T'><center id='TOy2T'></center></pre></bdo></b><th id='TOy2T'></th></span></q></dt></tr></i><div id='TOy2T'><tfoot id='TOy2T'></tfoot><dl id='TOy2T'><fieldset id='TOy2T'></fieldset></dl></div>

          • <tfoot id='TOy2T'></tfoot>

                1. <legend id='TOy2T'><style id='TOy2T'><dir id='TOy2T'><q id='TOy2T'></q></dir></style></legend>
                  本文介绍了JSFiddle包装在onLoad中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试根据以下描述了解 JSFiddle 如何在onLoad"中包装"代码:[1]:http://doc.jsfiddle.net/basic/introduction.html#javascript.我已经看到在 HTML 的 BODY 标记中使用 onLoad 来加载函数.那么 JSF(在幕后)是否将我在其 JS 窗口中创建的每个调用和每个函数都包装起来?又名:

                  I'm trying to understand how JSFiddle 'wraps' code in 'onLoad' based on this description: [1]: http://doc.jsfiddle.net/basic/introduction.html#javascript. I've seen onLoad being used in the HTML's BODY tag to load function(s). So does JSF (behind the scenes) wrap every call and every function I create int its JS window? AKA:

                  onLoad = "myfunc1(),myfunc2,alert(1);" 
                  

                  如果是这样,那么当我选择 jQuery 作为框架时,我是否应该避免使用这种格式:

                  If so then when I select jQuery as a framework, should I avoid using this format:

                   $(document).ready(function(){
                       myfunc1{(...)}
                       myfunc1{(...)}
                       ...
                  

                  如果有电枢问题,请提前道歉.

                  Apologize in advance if an armature question.

                  推荐答案

                  他们把你所有的 JS 放在 <script> 标签内,并用 onLoad 事件代码包裹它.

                  They put all your JS inside <script> tags with the onLoad event code wrapped around it.

                  例如,如果您选择包含 jQuery 和 onLoad,那么这就是 jsfiddle 将使用的:

                  For example, if you choose to include jQuery and onLoad then this is what jsfiddle will use:

                  <script type="text/javascript">
                      //<![CDATA[
                          $(window).load(function(){ /* your js here */ });
                      //]]>
                  </script>
                  

                  如果您不包含库,那么他们使用:

                  If you don't include a library then they use:

                  <script type="text/javascript">
                      //<![CDATA[
                          window.onload=function(){ /* your js here */ }
                      //]]>
                  </script>
                  

                  我认为他们还使用其他库特定的 load 事件,具体取决于您选择包含的内容.

                  I presume they also use other library specific load events depending on what you choose to include.

                  在小提琴中运行代码时不需要使用 $(document).ready(function(){ });.

                  Using $(document).ready(function(){ }); isn't required when running your code in a fiddle.

                  注意:要更好地解释 CDATA 是什么,请查看此答案 - https:///stackoverflow.com/a/7092306/2287470

                  Note: for a good explanation of what CDATA is take a look at this answer - https://stackoverflow.com/a/7092306/2287470

                  这篇关于JSFiddle包装在onLoad中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我应该选择什么?jQuery、mootools、yui、scriptaculous 还是原型? 下一篇:如何选择 CSS 框架?

                  相关文章

                  • <bdo id='CjoHJ'></bdo><ul id='CjoHJ'></ul>
                  <i id='CjoHJ'><tr id='CjoHJ'><dt id='CjoHJ'><q id='CjoHJ'><span id='CjoHJ'><b id='CjoHJ'><form id='CjoHJ'><ins id='CjoHJ'></ins><ul id='CjoHJ'></ul><sub id='CjoHJ'></sub></form><legend id='CjoHJ'></legend><bdo id='CjoHJ'><pre id='CjoHJ'><center id='CjoHJ'></center></pre></bdo></b><th id='CjoHJ'></th></span></q></dt></tr></i><div id='CjoHJ'><tfoot id='CjoHJ'></tfoot><dl id='CjoHJ'><fieldset id='CjoHJ'></fieldset></dl></div>

                  1. <tfoot id='CjoHJ'></tfoot>
                    <legend id='CjoHJ'><style id='CjoHJ'><dir id='CjoHJ'><q id='CjoHJ'></q></dir></style></legend>

                    <small id='CjoHJ'></small><noframes id='CjoHJ'>