我利用window.open方式打开一个子窗口,我想从父窗口传递2个参数过去,一个参数jybgh是数据库字段,一个后台静态变量strSel,具体实现代码如下(不晓得写得正确否):
<script>
function jump(pram,pName)
{
window.open('edit/111.aspx?jybgh='+pram+'&pName='+pName,'','height=230, width=310, top=300, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
</script><asp:TemplateColumn>
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<FONT face="宋体"><INPUT style="WIDTH: 16px; HEIGHT: 13px" type="button" onclick=jump('<%# DataBinder.Eval(Container, "DataItem.jybgh")%>','<%=strSel%>')></FONT>
</ItemTemplate>
</asp:TemplateColumn>
但是我发现onclick=jump('<%# DataBinder.Eval(Container, "DataItem.jybgh")%>','<%=strSel%>')每次都使得父窗口的html界面显示时左下角出现一个黄色惊叹号!使得button按钮点击不能弹出子窗口,如果写成onclick=jump('<%# DataBinder.Eval(Container, "DataItem.jybgh")%>')页面就显示正常。请问这个问题如何解决啊?如何传递两个参数过去啊
<script>
function jump(pram,pName)
{
window.open('edit/111.aspx?jybgh='+pram+'&pName='+pName,'','height=230, width=310, top=300, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
</script><asp:TemplateColumn>
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<FONT face="宋体"><INPUT style="WIDTH: 16px; HEIGHT: 13px" type="button" onclick=jump('<%# DataBinder.Eval(Container, "DataItem.jybgh")%>','<%=strSel%>')></FONT>
</ItemTemplate>
</asp:TemplateColumn>
但是我发现onclick=jump('<%# DataBinder.Eval(Container, "DataItem.jybgh")%>','<%=strSel%>')每次都使得父窗口的html界面显示时左下角出现一个黄色惊叹号!使得button按钮点击不能弹出子窗口,如果写成onclick=jump('<%# DataBinder.Eval(Container, "DataItem.jybgh")%>')页面就显示正常。请问这个问题如何解决啊?如何传递两个参数过去啊
2.查看html源码.看看生成的html是啥样的.(onclick=jump这部分)
var strSel = <%=strSel%>;
function jump(pram)
{
window.open(url + '?jybgh='+pram+'&pName='+strSel,'','height=230, width=310, top=300, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
</script><asp:TemplateColumn>
<ItemStyle VerticalAlign="Top"> </ItemStyle>
<ItemTemplate>
<FONT face="宋体"> <INPUT style="WIDTH: 16px; HEIGHT: 13px" type="button" onclick=jump(' <%# DataBinder.Eval(Container, "DataItem.jybgh")%>')> </FONT>
</ItemTemplate>
</asp:TemplateColumn>
private void btnbhg_Click(object sender, System.EventArgs e)
{
string stryp = strnamedate +this.txtyinpin.Text;
string strupdate1="";
strupdate1+=" ywgn ='"+stryp+"'";
strupdate1+=",ywgnid="+2;
string strcmdL="update tbl_rwh set "+strupdate1+" where jybgh='"+jybgh+"'";
db.ExecuteSql (strcmdL);
Response.Write("<script>window.opener.location.href=window.opener.location.href; </script>");
//window.opener.location.reload();
Response.Write("<script>window.close();</script>");
}