您是否尝试过window.opener.location.href(在javascript中)?
你也可以打电话给
pageMethod
在JavaScript中,使用Opener从(服务器端查询)中取回您的CSS,并将其应用到JavaScript中的页面。
Link
弹出式.aspx
<form id="form1" runat="server">
<asp:ScriptManager EnablePageMethods="true" runat="server"></asp:ScriptManager>
<div>
<script>
function call() {
var location = window.opener.location.href;
PageMethods.GetPhoneNumber(location, clientcall);
}
function clientcall(phone){
alert(phone);
}
</script>
<a href="javascript:call();">Call</a>
</div>
</form>
弹出.aspx.cs
使用制度;
使用system.collections.generic;
使用system.linq;
使用system.web;
使用system.web.ui;
使用system.web.ui.webcontrols;
使用system.web.services;
public partial class Popup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string GetPhoneNumber(string referer)
{
//在此处输入调用数据库的代码
返回“888-888-888”;
}
}
呼叫页
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script>
function opening() {
window.open("Popup.aspx","mywindow", "status=1,toolbar=1");
}
</script>
<a href="#" onclick="opening()">Ouvrir</a>
</body>
</html>