一直不成功,求高手修改一下
下面是我的代码
- JScript code
$(document).ready(function(){ $("dd a").click(function(){ $(".THEembed").attr("src", "($(this).attr('id')"); }); });
- HTML code
<dl id="menu"> <dt class="dt-01" >Dota大赛宣传片</dt> <dd><a href="#" id="http://player.youku.com/player.php/sid/XMjIzMjY0OTA4/v.swf" >Dota宣传片1</a></dd> <dd><a href="#" id="http://player.youku.com/player.php/sid/XMzQyMjA5MTQ0/v.swf" >Dota宣传片2</a></dd> </dl> <embed class="THEembed" src="http://player.youku.com/player.php/sid/XMjQ4NTQ5MzMy/v.swf" width="720" height="593"allowFullScreen="true" quality="high" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>
------解决方案--------------------
$(document).ready(function(){
$("dd a").click(function(){
var srcid=$(this).attr('id');
$(".THEembed").attr("src",srcid);
});
});
试试
------解决方案--------------------
$(".THEembed").attr("src", $(this).attr('id'));