Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在onclick中找不到Javascript/laravel-函数_Javascript_Laravel - Fatal编程技术网

在onclick中找不到Javascript/laravel-函数

在onclick中找不到Javascript/laravel-函数,javascript,laravel,Javascript,Laravel,我有以下Javascript文件: $(document).ready(function() { $("#myTable").tablesorter(); setHeightByAttr('Sum'); } ); function setAllSameHeight() { var t = document.getElementById("myTable"); for(var i=0; i<t.rows.length; i++){

我有以下Javascript文件:

$(document).ready(function() 
{ 
    $("#myTable").tablesorter(); 
    setHeightByAttr('Sum');
} 
); 

function setAllSameHeight()
{
    var t = document.getElementById("myTable");
    for(var i=0; i<t.rows.length; i++){
        t.rows[i].style.height = "30px"; 
    }

}

function setHeightByAttr(attr)
{
    //find the index of the attribute and save it in a variable called index



    setTimeout(function() {
        var index = null;
        var t = document.getElementById("myTable");
        for(var i = 0; i < t.rows[0].cells.length; i++){
            if(t.rows[0].cells[i].innerText == attr+"\n"){
                index = i;
                break
            }
        }
        t.rows[1].style.height = "30px";
        for(var i=2; i < t.rows.length; i++) {
            var sumi = t.rows[i].cells[index].innerHTML;
            var sumiminus1 = t.rows[i-1].cells[index].innerHTML;
            t.rows[i].style.height = 30+30*(Math.abs(sumi-sumiminus1)).toString()+"px";

        }   
    }, 5);
}
编辑2:

以下是生成的HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="csrf-token" content="nfnpuH42cZDLQD8TbCQkyK8z1lFGKiQqJC6X34DT">
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  <title>Home
 - CS3226 RankList 2020</title>

  <!-- Bootstrap -->    
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">

    <meta name="csrf-token" content="nfnpuH42cZDLQD8TbCQkyK8z1lFGKiQqJC6X34DT">


  <!-- Custom styles for this template -->
  <link href="/css/navbar.css" rel="stylesheet">
  <link href="/css/flag-icon.min.css" rel="stylesheet">
  <link href="/css/bootstrap.min.css" rel="stylesheet">
  <!-- <link href="https://fonts.googleapis.com/css?family=Nunito+Sans%7cRaleway" rel="stylesheet"> -->
</head>
<body>
  <div class="container">
      </div>
  <!-- Static navbar -->
  <nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">CS3233 Ranklist 2020</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li id="home" class="active"}}><a href="/">Home</a></li>
                <li id="history" }}><a href="/history">History</a></li>
          <li id="help" }}><a href="/help">Help</a></li>
                                            </ul>
        <ul class="nav navbar-nav navbar-right">
          <!-- Authentication Links -->
                    <li  ><a href="https://app.lzr.im/login">Login</a></li>
          <li  ><a href="https://app.lzr.im/register">Register</a></li>
                </ul>
        </div><!--/.nav-collapse -->
    </div><!--/.container-fluid -->
  </nav>

    <div class="loader" style="margin:0 auto;"></div>
  <div id="tableLoaded"></div>


  <footer class="footer">
  <div class="container">
    <p class="text-right">© 2017 M. Ashmawi, C. G. Lim, Z. Lin, K. Xiao, S. F. Zarrinkoub & H. Zhao. <a href="https://github.com/cs3226-2017-3c" target="_blank"><img width="12" alt="GitHub" src="/img/GitHub-Mark-32px.png"></a></p>
      </div>
  </footer>

  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script>
  $('div.alert').not('.alert-important').delay(3000).fadeOut(350);
  </script>
    <script type="text/javascript" src="js/loader.js"></script>

  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.5/js/jquery.tablesorter.min.js"></script>
</body>
</html>

家
-CS3226 RankList 2020
切换导航

©2017 M.Ashmawi,C.G.Lim,Z.Lin,K.Xiao,S.F.Zarrinkoub&H.Zhao

$('div.alert')。非('.alert-important')。延迟(3000)。淡出(350);
我不知道为什么会发生这种情况,但如果有帮助,我找到了解决方法:

window.functionName =function(){
 //code and stuff
}

我不知道为什么会发生这种情况,但如果有帮助的话,我找到了解决办法:

window.functionName =function(){
 //code and stuff
}

你能发布生成的HTML吗?你在哪里包含你的js文件?我看不见。我不知道它在laravel中是如何工作的,但我不需要为“SetAllSamehight”设置它,它在HTML中被成功调用,并且在同一个JS文件中。该文件似乎没有包括在内,或者它是loader.JS?您的模板中可能有错误,因为
  • (以及其他一些文件)生成的HTML中包含的内容是错误的……您可以发布生成的HTML吗?您的js文件包含在哪里?我看不见。我不知道它在laravel中是如何工作的,但我不需要为“SetAllSamehight”设置它,它在HTML中被成功调用,并且在同一个JS文件中。该文件似乎没有包括在内,或者它是loader.JS?您的模板中可能有错误,因为
  • (以及其他一些文件)你在生成的HTML中的错误…你救了我的一天你救了我的一天
    window.functionName =function(){
     //code and stuff
    }