推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
xxawa

关于 document 的问题,高手请进

  •  
  •   xxawa · Dec 7, 2015 · 1858 views
    This topic created in 3836 days ago, the information mentioned may be changed or developed.

    <script type="text/javascript" src="http://baidu.com/js/b.js"></script>
    <script type="text/javascript">
    if (document.getElementById("baidu") == undefined)
    {
    document.location.href ="http://baidu.com/xxx.html";
    }

    </script>

    <div class="container">
    <p><button id="open-xx" type="button">打开</button></p>
    </div>
    

    如上面两段代码,第一段是检测 b.js 里面有没有 baidu 如果没有执行网址跳转。
    第二段打开按钮执行 open-xx

    现在我想把两段代码何在一起,首先检测 b.js 如果没有发现 baidu 执行 open-xx

    请问该怎么做?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3131 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:40 · PVG 21:40 · LAX 06:40 · JFK 09:40
    ♥ Do have faith in what you're doing.