window.opener=null; 不要
window.close(); this去掉

解决方案 »

  1.   

    加一个这个试试 看
    <body>  <base target="_self">
      

  2.   

    这个已经加了.
    就是在执行close的时候,没有直接关闭,而是出现提示窗口问是否关闭窗口?
      

  3.   

    window.opener=null;window.close(); 我的可以啊~~
      

  4.   

    function OpenDialog(arg)
    {
      var ret = window.showModalDialog("../image/imgupload.aspx","","dialogHeight: 150px; dialogWidth: 330px; dialogTop: 200px; dialogLeft: 300px; edge: Raised; center: Yes; help: no; resizable:no; status: no;");
      if (ret != null)
        arg.value = ret;
    }与这个的参数有没有关系?
      

  5.   

    总感觉<base target="_self">
    这句话好像不起作用?
      

  6.   

    window.close(this)改为window.top.close(this)
      

  7.   

    window.close(this)改为window.parent.close()或window.top.close()
      

  8.   

    文件名:imgUpload.aspx
    <%@ Page language="c#" Codebehind="ImgUpload.aspx.cs" AutoEventWireup="false" Inherits="QingdaoCate.Web.Image.ImgUpload" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <base target="_self">
    <script language="javascript" src="../../JS/ChinJS.js"></script>
    <LINK href="../../Style/ChinStyle.css" type="text/css" rel="stylesheet">
    </HEAD>
    <body>
    <form id="form1" name="form1" encType="multipart/form-data" runat="server">
    &nbsp;&nbsp;
    <TABLE id="Table1" cellSpacing="1" cellPadding="3" width="300" border="0" class="tblBody">
    <TR>
    <TD colSpan="3" class="tblHeader">上传图片</TD>
    </TR>
    <TR>
    <TD noWrap>选择图片</TD>
    <TD>
    <input id="UploadFile" type="file" runat="server" NAME="UploadFile" class="TextBox"></TD>
    <TD>
    <asp:button Text="上传" runat="server" ID="btnUpload" CssClass="Button" /></TD>
    </TR>
    <TR>
    <TD colSpan="3" class="tdCenter">
    <asp:Label id="message" runat="server" CssClass="message"></asp:Label></TD>
    </TR>
    </TABLE>
    </form>
    </body>
    </HTML>
      

  9.   

    imgUpload.cs文件using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.IO;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Text;
    namespace QingdaoCate.Web.Image
    {
    public class ImgUpload : Page
    {
    protected System.Web.UI.HtmlControls.HtmlInputFile UploadFile;
    protected System.Web.UI.WebControls.Button btnUpload;
    protected System.Web.UI.WebControls.Label message;
    private void Page_Load(object sender, System.EventArgs e)
    {
    btnUpload.Attributes["onClick"]="return imguploadValid();";
    } #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {    
    this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void btnUpload_Click(object sender, System.EventArgs e)
    {
    Business.Image image=new Business.Image();
    int currentRow=image.Insert(UploadFile.PostedFile);
    if(currentRow> 0)
    {
    StringBuilder strScript = new StringBuilder();
    strScript.Append(@"<script language=JavaScript>" + "\n");
    strScript.Append(@" window.returnValue='" +currentRow+ "';" + "\n");
    strScript.Append(@" window.opener=null;window.top.close(this);" + "\n");
    strScript.Append(@"</script>");
    Page.RegisterClientScriptBlock("setValue", strScript.ToString());
    }
    else
    {
    message.Text="图片上传的过程中出现错误";
    }
    }
    }
    }
      

  10.   

    chinjs.js里面的//弹出窗口,输入图片
    function OpenDialog(arg)
    {
    var ret = window.showModalDialog("../image/imgupload.aspx","Dialog Arguments Value","dialogHeight: 150px; dialogWidth: 330px; dialogTop: 200px; dialogLeft: 300px; edge: Raised; center: Yes; help: no; resizable:no; status: no;");
    if (ret != null)
    arg.value = ret;
    }
      

  11.   

    试试这段代码
      OpenDialog(document.forms[0].all[\"imgID\"]);