【发布时间】:2017-10-18 05:47:55
【问题描述】:
我在 iframe 中有一个普通的 html 表格,我想从父页面访问它(是的,它们在域和服务器上) 我已经尝试了各种:
$("#Iframe").contents().find("#mytable td");
我认为它根本没有检测到我的表格单元格或表格。 我确实想在上面做一个活动。
$("#mytable td")
.mousedown(function ()
{
isMouseDown = true;
$(this).toggleClass("highlighted");
isHighlighted = $(this).hasClass("highlighted");
return false;
})
.mouseover(function () {
if (isMouseDown) {
$(this).toggleClass("highlighted", isHighlighted);
}
})
此事件在链接 css 样式的单个页面上完美运行,但在使用 iframe 时我应该怎么做?在 iframe 中检测我的表格的正确句子是什么?
【问题讨论】:
-
parent.opener.document.getElementById("street1").value = street1;你可以像这样从 iframe 设置父元素 -
很多建议here
标签: javascript jquery html iframe html-table