【发布时间】:2013-12-08 18:59:24
【问题描述】:
我正在尝试将我的 HTML 主页链接到外部 css 样式表和外部 javascript(.js) 文件。无论出于何种原因,取决于我在 HTML 文件中列出它们的顺序,其中只有一个可以工作。我在 Javascript 文件中使用了一个简单的警报框来测试它是否正常工作,并且仅在首先链接 javascript 文件时才有效。这是我的工作......(顺便说一句,我也是一个 HTML 菜鸟)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8 />
<link rel="stylesheet" href="trinity.css" />
<Script src="churchJavaScript.js"></script>
<title>Trinity Temple</title>
</head>
<body>
<div id="CompleteWrapper">
<header id="headerSection">
<h1> Trinity Temple</h1>
<h3> And I sent messengers unto them, saying, I am doing a great work, so that I cannot come down: </br>
why should the work cease, whilst I leave it, and come down to you? Nehemiah 6:3 </h3>
</header>
<nav id="navSection">
<ul>
<li>Home</li>
<li><a href="serviceInformation.html">Service Information</a></li>
<li><a href="aboutUs.html">About Us</a></li>
<li><a href="directory.html">Directory</a></li>
<li><a href="contactUs.html">Contact Us</a></li>
</ul>
</nav>
<section id="sectionSection">
<h3> Welcome to Trinity Temple Church of God In Christ! </h3></br>
<hr width = 75% size= "1" color="#b20000" />
testing tolaslksdflksdflksdflkslkdslkjdslksfdlkdslkdslk</br>
testing tolaslksdflksdflksdflkslkdslkjdslksfdlkdslkdslk</br>
testing tolaslksdflksdflksdflkslkdslkjdslksfdlkdslkdslk</br>
testing tolaslksdflksdflksdflkslksadfsadfsdafsdadslkjdslksfdlkdslkdslk</br>
testing tolaslksdflksdflksdflkslkdslkjdslksfdlkdslkdslk</br>
testing tolaslksdflksdflksdflkslkdslkddddddjdslksfdlkdslkdslk</br>
testing tolaslksdflksdflksdflkslkdslkjdslksfdlkdslkdslk</br>
</section>
<aside id="asideSection">
</aside>
<footer id="footerSection" >
2900 Josephine St. </br>
Denver, CO 80207
</footer>
</div>
</body>
</html>
这是外部文件中的 javascript 代码...
window.addEventListener("load", todaysDate, false);
function todaysDate(){
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var completeDate = document.getElementById("footerSection");
footerSection.innerHMTL = "Today's Date: " +completeDate;
alert(month + "/" + day + "/" + year);
}
window.addEventListener("load", todaysDate, false);
另外,这里是服务信息html doc中的代码...
<!doctype html>
<html >
<head lang="en">
<meta charset="utf-8"/>
<script src="churchJavaScript.js"> </script>
<link rel="stylesheet" href="trinity.css"/>
<title> Service Information</title>
</head>
<body>
<div id="CompleteWrapper">
<header id="headerSection">
<h1> Trinity Temple</h1>
<h3> And I sent messengers unto them, saying, I am doing a great work, so that I cannot come down: </br>
why should the work cease, whilst I leave it, and come down to you? Nehemiah 6:3 </h3>
</header>
<nav id="navSection">
<ul>
<li><a href="index.html">Home</a></li>
<li>Service Information</li>
<li><a href="aboutUs.html">About Us</a></li>
<li><a href="directory.html">Directory</a></li>
<li><a href="contactUs.html">Contact Us</a></li>
</ul>
</nav>
<section id="sectionSection">
<h2> Service Information </h2></br>
<hr width = 75% size= "1" color="#b20000" />
<h3>Sunday</br></h3>
Sunday School: Sunday 9am - 10:30am </br>
Sunday Service: Sunday 10:30 - 1:00pm</br>
</br>
<h3>Wednesday</br></h3>
Bible Study: 6:30pm - 8:30pm
</br>
</section>
<aside id="asideSection">
</aside>
<footer id="footerSection" >
2900 Josephine St. </br>
Denver, CO 80207
</footer>
</div>
</body>
</html>
【问题讨论】:
标签: javascript html css