日期:2014-05-16 浏览次数:20377 次
<html><head>
<script>
document.getElementById("btn").onclick = function() {displayTime()};
function displayTime() {
document.getElementById("p").innerHTML = Date();
}
</script>
</head>
<body>
<p id="p">If you click the button,I will show the date.</p>
<button type="button" id="btn">show date</button>
</body>
</html>
function displayTime() {
document.getElementById("p").innerHTML = Date();
}
window.onload = function(){
document.getElementById("btn").onclick = function() {displayTime()};
}