通过 DIV 数据打开图像

Open image via DIV data

本文关键字:图像 数据 DIV 通过      更新时间:2023-09-26

我再次请求您的帮助,我有一个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