如何在 HTML 页面中显示图像

我有一个带有可点击按钮的网页,点击后应显示图像。 使用小提琴时它工作正常,但当我离线时它不显示任何图像。

这是下面的代码。

**

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">

    <script src="jquery-1.8.3.min.js"></script>
    
    <script>
        $('#btn').on('click',function() {
    $('#img').attr('src',$('#url').val());
    });
    </script>


    <style>
        .center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 30%;
}
    </style>
    <title>Document</title>
</head>
<body>
    <br><br>
<img src="" id="img" class="center">

<br><br>

Type in a URL to an image below :<br><br>

<input type="text" id="url"/><input type="button" id="btn" value="show image" />

</body>
</html>

**

haotianxuelang 回答:如何在 HTML 页面中显示图像

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/601.html

大家都在问