zoukankan      html  css  js  c++  java
  • jqery 图片等 比例缩放

    后台添加加载图片的方法(从编辑器里为图上添加一个名为jzsmsimglightbox样式的类)

    public string GetHtmlImageUrlList(string sHtmlText)
    {
    // 定义正则表达式用来匹配 img 标签
    Regex regImg = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase);

    // 搜索匹配的字符串
    MatchCollection matches = regImg.Matches(sHtmlText);
    int i = 0;
    string[] sUrlList = new string[matches.Count];

    // 取得匹配项列表
    foreach (Match match in matches)
    {
    sUrlList[i++] = match.Groups["imgUrl"].Value;
    string newimg = "<a class=\"jzsmsimglightbox\" href=\"" + match.Groups["imgUrl"].Value.Replace("_", "") + "\" target=\"_blank\">" + match.ToString() + "</a>";
    sHtmlText = sHtmlText.Replace(match.ToString(), newimg);
    }
    return sHtmlText;
    }

    前台引用相关js

    <link href="../LightBox-0.5/css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css" />
    <script src="../LightBox-0.5/js/jquery.lightbox-0.5.js" type="text/javascript"></script>

  • 相关阅读:
    HTTP 和 HTTPS
    HTTP 协议
    基础查询
    python编程从入门到实践笔记
    python-32-类的组合与初识继承
    python-31-初识面向对象与自定义类
    python-30-异常处理
    python-29-模块与包导入
    python-28-序列化模块
    python-27-其他常用模块(二)
  • 原文地址:https://www.cnblogs.com/qzxj/p/5280506.html
Copyright © 2011-2022 走看看