2013-02-20 81 views
1

我有這樣的代碼:Highcharts是未定義

  <html> 
     <head> 
    <title><%=sAtaskaitaTitle%></title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> 
    <link rel="stylesheet" type="text/css" href="style.css"> 
    <style type=text/css> 
      TH, TD.clTD, TABLE.thinTable 
      { 
       border-right: 1px solid; 
       border-top: 1px solid; 
       border-left: 1px solid; 
       border-bottom: 1px solid; 
      } 
    </style> 
    <script language="vbscript"> 

     Sub OnLoadFunc() 
      self.moveTo 0,0 
      self.resizeTo window.screen.availWidth,window.screen.availHeight 
      document.all.btnclose.focus() 
     End Sub 

    </script> 

    <script type="text/javascript" src="javascript_charts/jquery.min.js"></script> 
    <script type="text/javascript"> 
    $(function() { 
var chart; 
$(document).ready(function() { 
    chart = new Highcharts.Chart({ 
     chart: { 
      renderTo: 'container', 
      type: 'column', 
      margin: [ 50, 50, 100, 80] 
     }, 
     title: { 
      text: 'World\'s largest cities per 2008' 
     }, 
     xAxis: { 
      categories: [ 
       'Tokyo', 
       'Jakarta' 
      ], 
      labels: { 
       rotation: -45, 
       align: 'right', 
       style: { 
        fontSize: '13px', 
        fontFamily: 'Verdana, sans-serif' 
       } 
      } 
     }, 
     yAxis: { 
      min: 0, 
      title: { 
       text: 'Population (millions)' 
      } 
     }, 
     legend: { 
      enabled: false 
     }, 
     tooltip: { 
      formatter: function() { 
       return '<b>'+ this.x +'</b><br/>'+ 
        'Population in 2008: '+ Highcharts.numberFormat(this.y, 1) + 
        ' millions'; 
      } 
     }, 
     series: [{ 
      name: 'Population', 
      data: [34.4, 21.8], 
      dataLabels: { 
       enabled: true, 
       rotation: -90, 
       color: '#FFFFFF', 
       align: 'right', 
       x: 4, 
       y: 10, 
       style: { 
        fontSize: '13px', 
        fontFamily: 'Verdana, sans-serif' 
       } 
      } 
     }] 
    }); 
}); 

}); 
</script> 

</head> 

<body onload="OnLoadFunc"> 

    <form id="FORM1" method="post" action="par_atask01.asp"> 
    <input type="hidden" name="CMD" id="CMD" value=""> 
    <table width="100%" style="position:absolute;top:10pt;left:10pt;" id="Table1"> 
     <tr> 
      <td nowrap colspan="4" align="left"> 
       <input type="button" name="btnclose" style="position:relative;" value=" &nbsp; &nbsp; &nbsp;Grįžti &nbsp; &nbsp; &nbsp;" onclick="window.close()" id="btnclose"> 
       <input type="button" value="&nbsp;Spausdinti&nbsp;" name="btnprint" id="btnprint" language="VBscript" onclick="window.print()"> 
      </td> 
     </tr> 
     <tr> 
      <td align="center" style="font-size:13px;"> 
       <b><i><%=sAtaskaitaTitle%></i></b> 
       <br> 
       <%=Left(Now(),10)%> 
       <br> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <%=GetAtaskaitaInfo(VYKDYTOJAS_SBJ_ID,KONTROLIERIUS_SBJ_ID)%> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <br> 

      </td> 
     </tr> 
    </table> 
    </form> 
    <br> 

    <script src="javascript_charts/highcharts.js"></script> 
    <script src="javascript_charts/exporting.js"></script> 

    <div id='container' style='min-width: 400px; height: 400px; margin: 0 auto'></div> 
</body> 

我得到這樣的錯誤:

SCRIPT1024: Expected statement 
highcharts.js, line 1 character 1 
SCRIPT1024: Expected statement 
exporting.js, line 1 character 1 
SCRIPT5009: 'Highcharts' is undefined 
par_atask01.asp, line 105 character 9 
SCRIPT5009: 'Highcharts' is undefined 
par_atask01.asp, line 105 character 9 

我一點都沒有改變JavaScript文件。路徑被正確定義。 什麼可以是理由?

+0

當您查看控制檯中的代碼時。你看到兩個外部腳本的JS代碼嗎? – epascarello 2013-02-20 22:16:39

+0

Highcharts不應該在大寫字母H(highcharts)中,並且在使用它之前應該引用庫highcharts.js。 – Peter 2014-05-21 12:46:56

回答

2

在黑暗中拍攝,將缺少的類型添加到腳本標記中。

<script type="text/javascript" src="javascript_charts/highcharts.js"></script> 
<script type="text/javascript" src="javascript_charts/exporting.js"></script> 

設置類型,因爲您只使用IE瀏覽器VBScript。我想知道它是否認爲你在那裏使用VBScript。

+0

是的,你是對的!非常感謝,epascarello! – 2013-02-20 22:44:58

0

您是否在javascript_charts/highcharts.js中定義了Highcharts?如果是這樣,請確保您沒有在名稱空間中執行此操作。

+0

腳本的鏈接添加在底部。 – epascarello 2013-02-20 22:19:53

+1

它應該是一個評論 – bsiamionau 2013-02-22 14:37:39