我有一个从csv文件中提取的日期。这是我的代码。它在标题中显示未定义,它应显示日期。请帮忙。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Commtech Automation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="font-awesome.min.css" rel="stylesheet">
<!-- iCheck -->
<link href="green.css" rel="stylesheet">
<!-- bootstrap-progressbar -->
<link href="bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
<!-- bootstrap-navbar -->
<link href="bootstrap-theme.min.css" rel="stylesheet">
<!-- jVectorMap -->
<!-- <link href="css/maps/jquery-jvectormap-2.0.3.css" rel="stylesheet"/> -->
<!-- Custom Theme Style -->
<link href="custom.min.css" rel="stylesheet">
<script src="jquery.js"></script>
<link rel="stylesheet" type="text/css" href="dc.css"/>
<link rel="stylesheet" type="text/css" href="bootstrap.css"/>
<link rel="stylesheet" href="introjs.css" />
<!-- Displaying Date in navbar (header)-->
<a class="navbar-brand" href="#">Date:</a>
<a id="mydate" class="navbar-brand" href="#"></a>
<script src="intro.js" type="text/javascript"></script>
<script type="text/javascript" src="d3.js"></script>
<script type="text/javascript" src="crossfilter.js"></script>
<script type="text/javascript" src="dc.js"></script>
<script type="text/javascript" src="FileSaver.js"></script>
<script src='bootstrap.min.js' type='text/javascript'></script>
<script type="text/javascript">
//var parseDate = d3.time.format("%d/%m/%Y").parse;
<!--Getting the CSV file by using d3 library-->
d3.csv("SO.csv", function(error, experiments) {
<!--Return the date column from csv and display in the header-->
var mydate=experiments.filter(function(d) { return d.AS_ON_DATE })[0].value;
alert(mydate);
document.getElementById("mydate").innerHTML=mydate;
<!-- Initially tried to add this code, but didn't work.-->
//experiments.forEach(function(d) {
// d.AS_ON_DATE = parseDate(d.AS_ON_DATE);
// });
取消定义未定义日期。CSV文件(2016年8月5日)中出现的日期应放在标题中。