Пример #1
0
        public static bool LoadJsFile(HtmlDocument doc, string js)
        {
            bool noErr = true;
            string file = String.Empty;
            try
            {
                string[] files = js.Split(new char[] { ',' });
                foreach (string f in files)
                {
                    file = GlobalVar.AppPath + "res\\" + f + ".js";

                    string s = Utility.ReadFile(file);
                    noErr &= !String.IsNullOrEmpty(s);

                    if(String.IsNullOrEmpty(s))
                        GlobalVar.Log.LogError("取得文件内空为空!",file);

                    ExecScript(doc, s);

                }
                doc.Write("<script language='javascript'>alert('hello');</script>");

            }

            catch (System.Exception )
            {
                MessageBox.Show("load [" + file + "] error");
                return false;
            }
            return noErr;
        }