Page.RegisterStartupScript("key1","<script language=\"javascript\">parent.window.location.href='default.aspx?close=yes&file=path';window.close();</script>");
如果path是个变量要怎么写呢?

解决方案 »

  1.   

    string path="xxx";Page.RegisterStartupScript("key1","<script language=\"javascript\">parent.window.location.href='default.aspx?close=yes&file="+path+"';window.close();</script>");
      

  2.   

    Page.RegisterStartupScript("key1","<script language=\"javascript\">parent.window.location.href='default.aspx?close=yes&file=" + path + "';window.close();</script>");
      

  3.   

    可以执行,谢谢两位,

    Page.RegisterStartupScript("key1","<script language=\"javascript\">opener.window.location.href=opener.window.location+'&file=path';window.close();</script>");
    如果这种情况又怎么写呢?
      

  4.   

    不是一样的吗:
    Page.RegisterStartupScript("key1","<script language=\"javascript\">parent.window.location.href += '?file=" + path + "';window.close();</script>");
      

  5.   

    Page.RegisterStartupScript("key1","<script language=\"javascript\">parent.window.location.href += '?file=" + path + "';window.close();</script>");
    这个就应该是很简单的