[英]How to get an HTML element from another page without using jQuery or AJAX?
我试图不使用Jquery或AJAX来获取另一页中的td
的ID。
<td id="message"></td>
Try this Code: 尝试以下代码:
var x=document.getElementsByTagName("td")[0].id; var x = document.getElementsByTagName(“ td”)[0] .id;
0 is the index value of that td
element . 0是该
td
元素的索引值。 You will get the Id value from the variable x
. 您将从变量
x
获得Id值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.