aspx页面中的OnClientClick,和cs代码中的Response.Write("")
在Button中
<asp:Button ID="lblToInvoic" runat="server" OnClientClick="fff()" CssClass="btn2" Text="开发票" OnClick="lblToInvoic_Click" />
然后在页首写<script language="JavaScript">
function fff()
{
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/dot.gif)
}
和在cs文件里写:
protected void lblToInvoic_Click(object sender, EventArgs e)
{
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
..
Response.Write("<script>window.dialogArguments[0].document.getElementById(window.dialogArguments[1]).value =\"" + strValue1 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[2]).value =\"" + strValue2 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[3]).value =\"" + strValue3 + "\";window.dialogArguments[0].document.getElementById(window.dialogArguments[4]).value =\"" + strValue4 + "\";window.close();</script>");
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
}
是一样的。
只是代码位置不同。
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
然后在页首写<script language="JavaScript">
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
和在cs文件里写:
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
是一样的。
只是代码位置不同。