gpt4 book ai didi

javascript - 通过 DIV 数据打开图像

转载 作者:太空宇宙 更新时间:2023-11-04 10:40:46 25 4
gpt4 key购买 nike

我再次请求你的帮助,我有一个 ftp,其中有一些我想使用的音乐封面 http://inlivefm.6te.net/capas/ .

我还有一个 javascript 可以给我封面链接的数据:他现在要提供的链接 http://inlivefm.6te.net/capas/I需要你的爱.jpg 最后一首歌播放

我使用 JavaScript 提供封面

<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Defino my variable global
var myObj = {};
$.ajax({
type: "GET",
url: "/AirPlayHistory.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('Song').each(function() {
// Definimos el atributo tittle
myObj.tittle = $(this).attr('title');

$(this).find('Artist').each(function() {
// Definimos el atributo artist
myObj.artist = $(this).attr('name');
});

$(this).find('Info').each(function() {
// Definimos el atributo time
myObj.time = $(this).attr('StartTime');
});

$(this).find('Info').each(function() {
// Definimos el atributo cover
myObj.cover = $(this).attr('JazlerID');
});

// Por ultimo lo mostramos :)
$('.cancion').html("<p>http://inlivefm.6te.net/capas/" + myObj.tittle + ".jpg</p>");
});
}
});
});
</script>
</head>
<body>
<div class="cancion"></div>
</body>
</html>

知道div给我封面的链接,想打开提供数据的直通图

<img src="<div class="cancion"></div>
"/>

我想要的例子是这样的:

<img src="http://inlivefm.6te.net/capas/I NEED YOUR LOVE.jpg"/>

我正在尝试执行此操作,但由于图像无法打开我无法执行此操作,所以我来寻求您的帮助。

非常感谢!

最佳答案

我相信您想要一张图片,点击它会将您带到另一个资源;这样做:

<a href='resource.URL' ><img src='image.URL' other_attributes /></a>

点击 image.URL 将带您到 resource.URL

关于javascript - 通过 DIV 数据打开图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35831478/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com