我在这里有2个链接,点击我需要的任何链接以获得最后修改日期和时间旁边..
<html>
<head>
</head>
<body>
<table border="1">
<tr>
<td><a href="" id="1"/a>First
</td>
<td>
<script>document.write(document.lastModified + "")</script>
</td>
</tr>
<tr>
<td><a href="#" id="2"/a>Second
</td>
<td width="200px">
<script>document.write(document.lastModified + "")</script>
</td>
</tr>
</body>
<html>
答案 0 :(得分:1)
尝试类似
的内容<html>
<head>
</head>
<body>
<table border="1">
<tr>
<td>
<a href="#" onclick="ShowDate(1)" id="1" >First</a>
</td>
<td>
<span id="firstDate"></span>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="ShowDate(2)" id="2">Second</a>
</td>
<td width="200px">
<span id="secondDate"></span>
</td>
</tr>
<script>
function ShowDate(location)
{
if(location == "1")
{
$("#firstDate").innerHtml = Date();
}
else if(location == "2")
{
$("#secondDate").innerHtml = Date();
}
}
</script>
</body>
<html>