js new Open window vaule send and receive get Problem
2011-02-08 14:12
295 查看
<script>
function OpentryCustomer()
{
var Txttry = "<%= Txttry.ClientID %>";
var Hitry = "<%= Hitry.ClientID %>";
var Apppath = "http://localhost:58945/WebSite1/"
var url = Apppath+"CustomerDialog.aspx?Userid="+Hitry+"&UserName="+Txttry+"";
alert(url);
window.open(url,'newwindows1','height=1000, width=700, top=10, left=10, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no');
}
</script>
<div>
<asp:Button ID="BtnSearch" runat="server" Text="SearchTry" OnClientClick="OpentryCustomer()" />
<asp:Button ID="btnReSelectCustomer_Main" runat="server" CausesValidation="False" Visible="false"/>
<asp:TextBox ID="Txttry" runat="server" Text="" />
<asp:HiddenField ID="Hitry" runat="server" />
</div>
另一个页面,
<script>
/* request类 */
function request(strParame) {
var args = new Object( );
var query = location.search.substring(1);
var pairs = query.split("&"); // Break at ampersand
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('=');
if (pos == -1) continue;
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
value = decodeURIComponent(value);
args[argname] = value;
}
return args[strParame];
}
</script>
<script>
function SelectCustomer()
{
var userid = request('Userid');
alert(userid);
var username= request('UserName');
alert(username);
var customerID=document.getElementById("<%= TxtName.ClientID %>").value;
alert(customerID);
var customerName=document.getElementById("<%= TxtID.ClientID %>").value;
alert(customerName);
if(window.opener!=null)
{
var id = window.opener.document.getElementById(userid);
alert(id);
if(id!=null)
{
id.value = customerID;
}
var customerNamCtrl = window.opener.document.getElementById(username);
alert(customerNamCtrl);
if(customerNamCtrl!=null)
{
customerNamCtrl.value = customerName;
}
window.close();
}
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Btn" runat="server" OnClientClick="SelectCustomer()" />
<asp:TextBox ID="TxtName" runat="server" Text="shabi"/>
<asp:TextBox ID="TxtID" runat="server" Text="shamao" />
</div>
function OpentryCustomer()
{
var Txttry = "<%= Txttry.ClientID %>";
var Hitry = "<%= Hitry.ClientID %>";
var Apppath = "http://localhost:58945/WebSite1/"
var url = Apppath+"CustomerDialog.aspx?Userid="+Hitry+"&UserName="+Txttry+"";
alert(url);
window.open(url,'newwindows1','height=1000, width=700, top=10, left=10, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no');
}
</script>
<div>
<asp:Button ID="BtnSearch" runat="server" Text="SearchTry" OnClientClick="OpentryCustomer()" />
<asp:Button ID="btnReSelectCustomer_Main" runat="server" CausesValidation="False" Visible="false"/>
<asp:TextBox ID="Txttry" runat="server" Text="" />
<asp:HiddenField ID="Hitry" runat="server" />
</div>
另一个页面,
<script>
/* request类 */
function request(strParame) {
var args = new Object( );
var query = location.search.substring(1);
var pairs = query.split("&"); // Break at ampersand
for(var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('=');
if (pos == -1) continue;
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
value = decodeURIComponent(value);
args[argname] = value;
}
return args[strParame];
}
</script>
<script>
function SelectCustomer()
{
var userid = request('Userid');
alert(userid);
var username= request('UserName');
alert(username);
var customerID=document.getElementById("<%= TxtName.ClientID %>").value;
alert(customerID);
var customerName=document.getElementById("<%= TxtID.ClientID %>").value;
alert(customerName);
if(window.opener!=null)
{
var id = window.opener.document.getElementById(userid);
alert(id);
if(id!=null)
{
id.value = customerID;
}
var customerNamCtrl = window.opener.document.getElementById(username);
alert(customerNamCtrl);
if(customerNamCtrl!=null)
{
customerNamCtrl.value = customerName;
}
window.close();
}
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Btn" runat="server" OnClientClick="SelectCustomer()" />
<asp:TextBox ID="TxtName" runat="server" Text="shabi"/>
<asp:TextBox ID="TxtID" runat="server" Text="shamao" />
</div>
相关文章推荐
- How can selenium web driver get to know when the new window has opened and then resume its execution
- UWP Test Webview JS interact, new window open (新窗口打开)
- open new window and page
- JS窗口问题处理:使弹出窗口保持前端显示的几种方法,及window窗体对象open()和showModalDialog()用法
- RegexKit: A Regular Expression Toolbox Based On NW.js(Node-Webkit) And Other Greate Open Source Projects.
- js的window.open基本应用
- JS窗口问题处理:使弹出窗口保持前端显示的几种方法,及window窗体对象open()和showModalDialog()用法
- JS Window.Open 打开窗口详解
- Sessions, Window Stations and Desktops(GetDesktopWindow函数得到的桌面句柄, 是Csrss.exe创建的一个窗口)
- js window.open
- 133.Your database is open and the LISTENER listener is running. The new DBA of the system stops the
- 从内部和外部的js文件中获取ASPX页面的控件ClientID(get control reference from inline and external javascript)
- Get the window data(lamda,flux, true) from a center point and the window width
- JS中window.open()详解 (转)
- JS window eval and load script!
- js window.open新打开窗口总是被浏览器拦截的问题
- js(window.open)浏览器弹框居中显示
- What is new and important info you can get from JavaOne 2007
- js window.open将参数传递到struts中出现的乱码问题解决
- openlayers copy and past(复制粘贴实现)copyfeature.js