【问题标题】:How to convert string pic URL to image and display in image tag .?如何将字符串 pic URL 转换为图像并显示在图像标签中。?
【发布时间】:2021-06-23 07:23:00
【问题描述】:

我喜欢这种图片网址

C:\inetpub\MaujApp\OMSAPI\ManualRecevingImages\WhatsApp Image 2021-03-24 at 12.07.41 PM.jpeg

我想使用 jQuery 转换原始图像并显示用户。 像这样使用 jQuery 和 C#

【问题讨论】:

    标签: javascript c# jquery asp.net ajax


    【解决方案1】:

    使用prepend

    下面将在<div> 中添加一个<img> 标记

    const imgUrl = "https://i.pinimg.com/originals/51/f6/fb/51f6fb256629fc755b8870c801092942.png"
    
    $('#theDiv').prepend('<img id="theImg" src="'+imgUrl+'" />')
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <div id="theDiv">
    </div>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-22
      • 2018-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-26
      • 1970-01-01
      相关资源
      最近更新 更多