zoukankan      html  css  js  c++  java
  • 通过js引用外部脚本(方便直接在浏览器上调试抓取代码)

    最近折腾爬虫,后端使用jQuery进行数据采集,一般都是先从浏览器中将采集代码调试好后直接放到后端跑了。

    有些网址没有引用jQuery,那调试起来就不方便了,可以用以下代码动态添加script标签,将jQuery引用到页面中。

    1.  
      var scriptBlock = document.createElement('script');
    2.  
      scriptBlock.src = 'http://code.jquery.com/jquery-1.11.1.js';
    3.  
      document.getElementsByTagName('head')[0].appendChild(scriptBlock);
     
     
  • 相关阅读:
    JSTL和EL
    JSP
    Servlet基础知识
    JSON基础知识
    jQuery基础知识
    ajax基础知识
    索引实战
    反射
    设计模式
    JVM的异常处理
  • 原文地址:https://www.cnblogs.com/soundcode/p/12653108.html
Copyright © 2011-2022 走看看