我有一个带有可点击按钮的网页,点击后应显示图像。 使用小提琴时它工作正常,但当我离线时它不显示任何图像。
这是下面的代码。
**
<!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>
**