本帖最后由 Ray_Chuang 于 2010-06-12 13:37:05 编辑

解决方案 »

  1.   

    <img id="myImg" src="..." />
    document.getElementById("myImg").src
      

  2.   


            public static string GetFirstImages(string htmlText)
            {
                const string pattern = "<img [^~]*?>";
                const string pattern1 = "src\\s*=\\s*((\"|\')?)(?<url>\\S+)(\"|\')?[^>]*";
                string s = null;
                Match match = Regex.Match(htmlText, pattern, RegexOptions.IgnoreCase);  //找到img标记
                if (match.Success)
                {
                    string img = match.Value;
                    string imgsrc = Regex.Match(img, pattern1, RegexOptions.IgnoreCase).Result("${url}");
                    imgsrc = Regex.Replace(imgsrc, "\"|\'|\\>", "", RegexOptions.IgnoreCase);
                    s = imgsrc;
                }
                return s;
            }获取第一张图片路径
      

  3.   

    <img id="Image1" alt="" src="images/1.jpg“ runat="server" />
    this.Image1.src
    就可以拿到啊
      

  4.   

    //创建一个另存为对话框
    OpenFileDialog save = new OpenFileDialog();
    //过滤条件
    save.Filter="JPEG(*.jpg;*.jpeg)|*.jpg;*.jpeg|BMP(*.bmp)|*.bmp";
    //显示
    save.ShowDialog();
    //得到选择的路径
    MessageBox.Show(save.FileName.ToString());
      

  5.   

    <img id="ImageName" alt="" src="images/1.jpg“ runat="server" />
    this.ImageName.src.Tostring();