财产“的textContent”当我点击有这方面,我的日期值“错误 遗漏的类型错误:无法读取的不确定财产‘的textContent’”遗漏的类型错误:无法读取的不确定
这是我的代码,你能帮我在确定错误的来源,我怎么能,如果你想查询的标签名称的元素,你可以使用getElementsByTagName
纠正这种
<?php
while($row = mysqli_fetch_array($query)){
$date = $row['Date'];
$time = $row['Time'];
$latitude= $row['Latitude'];
$longitude= $row['Longitude'];
$depth =$row['Depth'];
$magnitude = $row['Magnitude'];
//$array_lat_lon[] = $lat = $row['LAT'];
//$array_lat_lon[] = $lon = $row['LON'];
$the_arraypei[] = array($row['Date']); //added
//$the_array[] = array($row['LAT']."" , "".$row['LON']) ;
//$timestamp = strtotime()
echo '<tr class="normalRow"><td id="date2"><a href="#" onClick="functiontoget(\'$date\');">'.$date.'</a></td><td border="1">'.$time.'</td><td border="1">'.$latitude.'</td><td border="1">'.$longitude.'</td><td border="1">'.$depth.'</td><td border="1">'.$magnitude.'</td></tr>';
}?>
<script>
function functiontoget($date) {
var x = document.getElementsByTagName("#date")[0].textContent;
document.getElementById("demo").innerHTML = x;}
</script>
<p id="demo"></p>
'document.getElementsByTagName( “#日期”)'?它是什么 ? – passion
先生@激情多数民众赞成在$日期的价值....我不知道hmmmmm –