使用jquery从iframe刷新父页面上的div
||
我正在将fancybox的模式框与iFrame一起使用。如果从iFrame获得表单成功,我将使用以下代码:
<script type=\"text/javascript\">
window.setTimeout(\'window.top.location.href = \"/page.asp\"; \',999);
</script>
<script language=\"javascript\">
<!--
setTimeout(\"parent.$.fancybox.close();\",1000)
//-->
</script>
这将关闭fancybox的模式框并刷新父页面。我想使用jQuery将div定位为从iFrame在父页面上刷新。
我希望具有id = \“ target \”的父页面上的目标DIV刷新,而不是整个页面。如何使用JQuery进行操作?
TIA
下面的代码示例
父页面
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\"></script>
</head>
<body>
<div id=\"target\">
content content
</div>
</body>
</html>
表单验证后的iFrame页面
<head>
<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\"></script>
</head>
<script type=\"text/javascript\">
window.setTimeout(\'window.top.location.href = \"/parent_page.asp\"; \',999);
</script>
<script language=\"javascript\">
<!--
setTimeout(\"parent.$.fancybox.close();\",1000)
//-->
</script>
如何在父页面上创建函数以刷新div id = \“ target \”并从iFrame调用它。现在,整个父页面都会刷新。
没有找到相关结果
已邀请:
2 个回复
吐兄
捻盒愧杯
您可以在如何从iframe中的页面部分刷新父页面中逐步学习该技术。 希望这可以帮助。