使用Parameter从Code Behind调用JavaScript函数

时间:2013-03-23 11:13:34

标签: c# javascript

<script type="text/javascript">
    function test(a)
    {

        window.opener.document.forms[0].elements['src'].value = a;
    }
  </script>




protected void btnUpload_Click(object sender, EventArgs e)
{
    try
    {
        string filename = Path.GetFileName(this.fileuploadimages.PostedFile.FileName);
        fileuploadimages.SaveAs(Server.MapPath("~/Images/" + filename));
        ImageUrl = "~/Images/" + filename;
        btnUpload.OnClientClick = string.Format("test(\'{0}\');",ImageUrl);
        Response.Write("<script language="'javascript'"> {top.close() }</script>");
    }
    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }
}

我需要使用参数

调用名为test的javascript函数

我正在尝试上面但是它没有工作PLZ帮助我提前感谢

0 个答案:

没有答案