版面上有一个button,一个div,单击button,div中显示当前日期
答案:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题页</title>
<script type="text/javascript">
function btn_click()
{
var date=new Date();
div1.innerHTML=date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate();
}
</script>
</head>
<body>
<input type="button" id="btn" value="click" onclick="btn_click()" />
<div id="div1"></div>
</body>
</html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛