jeudi 3 juillet 2014

how to correctly make an iframe src equal whatever my variable equals?


Vote count:

0




I'm trying to make it so that whatever my variable, named "cover", equals in my html body, the iframe will use that as a source. I have it setup like this in my js file:



var cover = elem.attr('myFrame');

var cover = document.getElementById("myFrame");

$('.player .cover').attr('src','http://fakeurl.com/' + cover+'');


and then i have this in a part of the html body:



<iframe class="cover" id="myFrame"></iframe>


<ul id="audioplayer" class="playlist visible">

<li audiourl="1.mp3" cover="fakeurl1" artist="pinkzebra" album="AudioJungle">In the Moment of Inspiration</li>

<li audiourl="2.mp3" cover="fakeurl2.html" artist="pinkzebra" album="AudioJungle">Inspiring Ideas into Motion</li>

<li audiourl="3.mp3" cover="fakeurl3.html" artist="pinkzebra" album="AudioJungle">Peaceful Dawn</li>

<li audiourl="1.mp3" cover="fakeurl4.html" artist="pinkzebra" album="AudioJungle">Photos and Memories</li>
<li audiourl="2.mp3" cover="fakeurl5.html" artist="pinkzebra" album="AudioJungle">Soaring Spirit</li>

</ul><!-- /.playlist -->


The iframe shows the correct url (e.g. fakeurl.com) , but instead of adding what cover equals to the URL, it just enters in [object HTMLIFrameElement] any ideas how to make it say (in example, http://ift.tt/1osC5oG).



asked 32 secs ago






Aucun commentaire:

Enregistrer un commentaire