裏面我已經寫了一些jQuery來得到一個值,然後將其存儲在一個變量沒有問題:jQuery的:如何給一個變量賦值的.html
$(document).ready(function(){
$('a.news_video_player_list').click(function() {
var youtube = $(this).attr('id');
$('.news_vid_playerL').html('youtube');
});
});
現在,我有變量「YouTube」的視頻,我想將一些HTML放在一個名爲「.news_vid_playerL」的div中,其值爲變量值。我的目標是要做到這一點:
$('a.news_video_player_list').click(function() {
var youtube = $(this).attr('id');
$('.news_vid_playerL').html('<iframe title="YouTube video player" width="610" height="420" src="http://www.youtube.com/embed/+youtube+?&rel=0" frameborder="0" allowfullscreen></iframe>');
});
如果您在src路徑看,你會看到我把一個佔位符+ YouTube的+我想用變量的值來填充它。不知道如何解決這個問題。
謝謝!
很酷......那更好;)謝謝! – flinx777 2011-04-25 19:01:22