1
<object id="aa" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="650" height="400">
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<param name="movie" value="test.swf">
<embed src="test.swf" type="application/x-shockwave-flash" width="650" height="400"  bgcolor="#000000">
</object>

i want to change the value of src inside embed tag

  src="test.swf" to  src="newlink.swf"

tried something like this but not work.

            $("#aa").attr('src' 'new link'); 
2
  • The selector should be $("#aa") not $("aa") $("aa") is TAG NAME selector. Commented Jan 21, 2014 at 21:28
  • I don't believe you can change the URL of an SWF. You must remove the old object, and build a new one and append the new node to the document. Commented Jan 21, 2014 at 21:52

1 Answer 1

3

You need to use ID Selector ("#id")

 $("#aa embed").attr('src', 'new link'); 

OR

 $("#aa").find('embed').attr('src', 'new link');

DEMO

EDIT

var aa =  $("#aa").clone();
aa.find('embed').attr('src', 'http://jquery.thewikies.com/swfobject/fireworks.swf')
$("#aa").replaceWith(aa);
alert( $("#aa").find('embed').attr('src'));

DEMO

Sign up to request clarification or add additional context in comments.

1 Comment

@mwweb, in demo I have also modified value of <param name="movie" value="test.swf">, do take care of that when you implement it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.