我正在尝试运行我的脚本,但HTML在获取它时遇到了一些麻烦。我已经按照w3s教程,但我似乎无法在这里找到问题。
<!doctype html>
<html lang="en">
<head>
<title>Javascript</title>
<meta charset="utf-8">
<meta name="" content="HTML5">
<script type="text/javascript" src="h5.js"></script>
</head>
<body>
<p> Book details: <div id="bookDetails"> </div> </p>
</body>
</html>
h5.js
window.onload = callFunctions;
function callFunctions() {
var book = {
name: "Javascript",
authors: ["Carl Coder","Peter Programmer"],
isbn: "ABC-12345-XY",
bookDetails: function(){return "name:" + this.name + "authors:" + this.authors + "isbn: " + this.isbn;}
};
document.getElementById("bookDetails").innerHTML = book.bookDetails();
}