通过 AJAX 请求来获得并运行一个 JavaScript 文件:

 

HTML 代码:

<button >Run</button>
<div class="block"></div>

jQuery 代码:

jQuery.getScript("http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js",
 function(){
  $("#go").click(function(){
    $(".block").animate( { backgroundColor: 'pink' }, 1000)
      .animate( { backgroundColor: 'blue' }, 1000);
  });
});

相关文章:

  • 2022-01-20
  • 2022-12-23
  • 2022-01-21
  • 2021-08-27
  • 2021-10-01
  • 2022-12-23
猜你喜欢
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-10-22
相关资源
相似解决方案