码迷,mamicode.com
首页 > Web开发 > 详细

动态生成JS

时间:2014-10-20 11:21:50      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   io   os   ar   java   

 

bubuko.com,布布扣
           private void GenerateDrugAndProdJavaScript()
            {
                StringBuilder script = new StringBuilder();
                script.Append("<script type=text/javascript>");
                script.Append("function selectDrugAndProd(){");
                script.Append("var drug = document.getElementById(‘" + hdnDrug.ClientID + "‘).value;");
                script.Append("var productList = document.getElementById(‘" + hdnProduct.ClientID + "‘).value;");
                script.Append("result = showModalDialogDisplay(‘../Dialog/DrugProdSelect.aspx?" + ConstValue.QUERY_STRING_KEY_SELECTED_DRUG_CODE + "=‘ + drug + ‘" + "&" + ConstValue.QUERY_STRING_KEY_SELECTED_PRODUCT_CODES + "=‘ + productList" + ", null, 650, 400);");
                script.Append("if(result != null && typeof(result) == ‘object‘) {");
                script.Append("document.getElementById(‘" + hdnDrug.ClientID + "‘).value = result[0];");
                script.Append("document.getElementById(‘" + txtDrug.ClientID + "‘).value = result[1];");
                script.Append("document.getElementById(‘" + hdnDrugName.ClientID + "‘).value = result[1];");
                script.Append("document.getElementById(‘" + hdnProduct.ClientID + "‘).value = result[3];");
                script.Append("document.getElementById(‘" + txtProduct.ClientID + "‘).value = result[4];");
                script.Append("document.getElementById(‘" + hdnProductName.ClientID + "‘).value = result[4];");
                script.Append("}");
                script.Append("}");
                script.Append("</script>");
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "DrugAndProdJavaScript", script.ToString());
            }
View Code

 

动态生成JS

标签:des   style   blog   http   color   io   os   ar   java   

原文地址:http://www.cnblogs.com/haiy/p/4036666.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!