Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用javascript在codebehind中打开另一个表单_C#_Asp.net - Fatal编程技术网

C# 如何使用javascript在codebehind中打开另一个表单

C# 如何使用javascript在codebehind中打开另一个表单,c#,asp.net,C#,Asp.net,我有以下代码在按钮点击 Response.Write(“window.open('Contact.aspx')”) 上面的代码正在运行。但是如果使用 String s = "Contact.aspx"; Response.Write("<script type=text/javascript>window.open('"+s+"')</script>"); String s=“Contact.aspx”; Response.Write(“wind

我有以下代码在按钮点击 Response.Write(“window.open('Contact.aspx')”)

上面的代码正在运行。但是如果使用

String s = "Contact.aspx";
            Response.Write("<script type=text/javascript>window.open('"+s+"')</script>");
String s=“Contact.aspx”;
Response.Write(“window.open”(“+s+”)”);

上面的代码将错误显示为“文字太多”。有人能帮忙删除此错误吗。

我相信您缺少了“text/javascript”周围的引号

应该是:

String s = "Contact.aspx";
            Response.Write("<script type='text/javascript'>window.open('"+s+"')</script>");
String s=“Contact.aspx”;
Response.Write(“window.open”(“+s+”)”);