代码 如下: <script language="javascript">
var getFromParent = window.dialogArguments;
function CheckSelect() {
var aaaa = "";
for (var i = 0; i < window.document.formfoo.elements.length; i++) {
var e = this.formfoo.elements[i];
if (e.checked) {
if (aaaa == "") {
aaaa = e.value;
}
else {
aaaa = aaaa + "," + e.value;
}
}
}
return aaaa;
} function sendFromChild() {
window.returnValue = CheckSelect();
window.close();
} function CCC() {
window.returnValue = "";
window.close();
}
</script>
放到服务器上会出现window.document.formfoo 为空 或不是对象 的错误,这个页面是弹出层,弹出这个网页的那种弹出层整个页面代码如下<html>
<head>
<title>选择条件</title>
<meta http-equiv="Content-Language" content="zh-cn">
<link href="../Style/Style.css" type="text/css" rel="STYLESHEET">
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<base target="_self" />
<script language="javascript">
var getFromParent = window.dialogArguments;
function CheckSelect() {
var aaaa = "";
for (var i = 0; i < window.document.formfoo.elements.length; i++) {
var e = this.formfoo.elements[i];
if (e.checked) {
if (aaaa == "") {
aaaa = e.value;
}
else {
aaaa = aaaa + "," + e.value;
}
}
}
return aaaa;
} function sendFromChild() {
window.returnValue = CheckSelect();
window.close();
} function CCC() {
window.returnValue = "";
window.close();
}
</script>
</head>
<body scroll="no">
<form id="formfoo" method="post" runat="server">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%" bordercolorlight="#c0c0c0"
bordercolordark="#ffffff">
<tr>
<td height="22" background="../images/show_02.gif" align="left" style="font-size: 12px;
font-family: 宋体">
请选择您需要的项,然后点“确定”!
</td>
</tr>
<tr>
<td valign="top" style="text-align: center">
查询:<asp:TextBox ID="TextBox1" runat="server" Height="20px" Width="100px"></asp:TextBox><asp:ImageButton
ID="ImageButton4" runat="server" ImageAlign="AbsMiddle" ImageUrl="../images/Button/BtnSerch.jpg"
OnClick="ImageButton4_Click" /><br />
<table border="0" cellspacing="0" cellpadding="0" style="width: 318px; height: 49px">
<tr>
<td colspan="2" style="height: 31px; text-align: center;">
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
BorderWidth="1px" Width="100%" ShowHeader="False" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"
PageSize="10">
<PagerSettings FirstPageText="首页" LastPageText="最后一页" NextPageText="下一页" PreviousPageText="上一页" />
<FooterStyle BackColor="#F2F5FA" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input id="Checkbox1" value='<%#DataBinder.Eval(Container.DataItem, "SelectContent")%>'
type="checkbox" runat="server" />
</ItemTemplate>
<ItemStyle Width="30px" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SelectContent")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle Height="20px" HorizontalAlign="Center" />
<EmptyDataTemplate>
你所查看的选项无可用信息!
</EmptyDataTemplate>
<PagerStyle BackColor="White" />
<HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Size="12px"
Font-Strikeout="False" Font-Underline="False" ForeColor="HotTrack" Height="30px" />
</asp:GridView>
</td>
</tr>
<tr>
<td colspan="2" style="height: 31px; text-align: center;">
<asp:TextBox ID="TextBox4" runat="server" Enabled="False" Width="0px" Height="0px"></asp:TextBox>
<input type="button" value="确定" onclick="sendFromChild();" style="width: 70px"
class="BottonCss">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="22" background="../images/show_02.gif">
</td>
</tr>
</table>
</form>
</body>
</html>求解 ,谢谢
var getFromParent = window.dialogArguments;
function CheckSelect() {
var aaaa = "";
for (var i = 0; i < window.document.formfoo.elements.length; i++) {
var e = this.formfoo.elements[i];
if (e.checked) {
if (aaaa == "") {
aaaa = e.value;
}
else {
aaaa = aaaa + "," + e.value;
}
}
}
return aaaa;
} function sendFromChild() {
window.returnValue = CheckSelect();
window.close();
} function CCC() {
window.returnValue = "";
window.close();
}
</script>
放到服务器上会出现window.document.formfoo 为空 或不是对象 的错误,这个页面是弹出层,弹出这个网页的那种弹出层整个页面代码如下<html>
<head>
<title>选择条件</title>
<meta http-equiv="Content-Language" content="zh-cn">
<link href="../Style/Style.css" type="text/css" rel="STYLESHEET">
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<base target="_self" />
<script language="javascript">
var getFromParent = window.dialogArguments;
function CheckSelect() {
var aaaa = "";
for (var i = 0; i < window.document.formfoo.elements.length; i++) {
var e = this.formfoo.elements[i];
if (e.checked) {
if (aaaa == "") {
aaaa = e.value;
}
else {
aaaa = aaaa + "," + e.value;
}
}
}
return aaaa;
} function sendFromChild() {
window.returnValue = CheckSelect();
window.close();
} function CCC() {
window.returnValue = "";
window.close();
}
</script>
</head>
<body scroll="no">
<form id="formfoo" method="post" runat="server">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%" bordercolorlight="#c0c0c0"
bordercolordark="#ffffff">
<tr>
<td height="22" background="../images/show_02.gif" align="left" style="font-size: 12px;
font-family: 宋体">
请选择您需要的项,然后点“确定”!
</td>
</tr>
<tr>
<td valign="top" style="text-align: center">
查询:<asp:TextBox ID="TextBox1" runat="server" Height="20px" Width="100px"></asp:TextBox><asp:ImageButton
ID="ImageButton4" runat="server" ImageAlign="AbsMiddle" ImageUrl="../images/Button/BtnSerch.jpg"
OnClick="ImageButton4_Click" /><br />
<table border="0" cellspacing="0" cellpadding="0" style="width: 318px; height: 49px">
<tr>
<td colspan="2" style="height: 31px; text-align: center;">
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
BorderWidth="1px" Width="100%" ShowHeader="False" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"
PageSize="10">
<PagerSettings FirstPageText="首页" LastPageText="最后一页" NextPageText="下一页" PreviousPageText="上一页" />
<FooterStyle BackColor="#F2F5FA" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input id="Checkbox1" value='<%#DataBinder.Eval(Container.DataItem, "SelectContent")%>'
type="checkbox" runat="server" />
</ItemTemplate>
<ItemStyle Width="30px" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SelectContent")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle Height="20px" HorizontalAlign="Center" />
<EmptyDataTemplate>
你所查看的选项无可用信息!
</EmptyDataTemplate>
<PagerStyle BackColor="White" />
<HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Size="12px"
Font-Strikeout="False" Font-Underline="False" ForeColor="HotTrack" Height="30px" />
</asp:GridView>
</td>
</tr>
<tr>
<td colspan="2" style="height: 31px; text-align: center;">
<asp:TextBox ID="TextBox4" runat="server" Enabled="False" Width="0px" Height="0px"></asp:TextBox>
<input type="button" value="确定" onclick="sendFromChild();" style="width: 70px"
class="BottonCss">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="22" background="../images/show_02.gif">
</td>
</tr>
</table>
</form>
</body>
</html>求解 ,谢谢
<form id="formfoo" name="formfoo" method="post" runat="server">少个name 属性 name="formfoo"
function CheckSelect() {
var tmp = [],
form = document.getElementById("formfoo"),
items = form.getElementsByTagName("input");
for(var i = 0,len = items.length;i < len;i++){
var input = items[i];
if(input.checked) tmp.push(input.value);
}
return tmp.join(",");
}