Onclick无法使用外部.JS文件

时间:2018-03-08 18:40:06

标签: javascript html d3.js

我在这里做错了什么?我从我的html中获得了一个单独的js文件但是onclick似乎没有到达我拥有的js文件。如果我将功能代码放在html中,它可以工作。帮助我。

// jlhtml.html

/var/vhosts/website_1/access_log
/var/vhosts/website_2/access_log
etc...

// jljs.js文件在

下面
for each access_log file (one by virtual host)
    result = tail -50000 /var/www/vhosts/site.com/logs/access_log | egrep -i "select%20|union%20|'|1=1"
    if any line appear in the result then
        send mail(myemail@site.com, 'Warning!: Possible attack in virtual_host_i')
end;

1 个答案:

答案 0 :(得分:2)

我创建了一个简短的代码段,使用d3将Search函数绑定到按钮click事件。



var searchButton = d3.select("#searchButton").on("click", Search);
 
 function Search() {
   var me = (d3.select("#txtsearch").property("value"));
   alert(me);
 }

<!DOCTYPE html>
<html lang="en">

    <script src="https://d3js.org/d3.v3.min.js"></script>
    <meta charset="utf-8">

  <body>
    <center>
      <fieldset>
        <p>
          Search here: <input type="text" id="txtsearch" /> &nbsp;&nbsp;&nbsp;&nbsp
          <button id="searchButton">Find now</button>
        </p>
      </fieldset>
    </center>
  </body>

</html>
&#13;
&#13;
&#13;