• <bdo id='Bm5fy'></bdo><ul id='Bm5fy'></ul>

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

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

        <legend id='Bm5fy'><style id='Bm5fy'><dir id='Bm5fy'><q id='Bm5fy'></q></dir></style></legend><tfoot id='Bm5fy'></tfoot>

        JSFiddle包装在onLoad中?

        时间:2023-10-11

          <tbody id='YvSbV'></tbody>

            <tfoot id='YvSbV'></tfoot>

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

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

                  <legend id='YvSbV'><style id='YvSbV'><dir id='YvSbV'><q id='YvSbV'></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中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

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

                  相关文章

                  最新文章

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

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

                      <legend id='hSLju'><style id='hSLju'><dir id='hSLju'><q id='hSLju'></q></dir></style></legend><tfoot id='hSLju'></tfoot>

                      • <bdo id='hSLju'></bdo><ul id='hSLju'></ul>