我在 iFrame 中有一个 asp.net 页面。单击 iFrame 中 asp.net 页面上的 asp.net 按钮时,我想重定向父页面(位于 iFrame 之外)。
asp.net 按钮在重定向之前需要做一些处理,所以我想我需要从 asp.net 调用 javascript
最佳答案
只需在 javascript 中创建简单的 ans:
<script type="text/javascript">
function NewWindow() {
document.forms[0].target = "_top";
}
</script>
将其称为按钮之类的任何控件
<asp:LinkButton ID="linkbutton1" Text="Enroll Now" OnClientClick="NewWindow();" runat="server" onclick="enrol_Click"/>
关于asp.net - 从 iFrame 重定向父窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2904139/