views:

102

answers:

2

I have a webpage, on which I am using Ajax to replace different divs of my page against some click events.. All works fine for regular HTML... but when I want to add a SWF object tag through function

document.getElementByID("div-id").innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000> .... All flash movie code ... </object>";

My browser shows nothing.. and no error is generated also... I am assuming that it should show the Flash movie.. I have checked it in IE 8.0, FireFox, Chrome.. none of them is working.. I have monitored the div using firebug, it is showing that div is being replaced by the Flash player code, but then why it is not being displayed in that div?

A: 

Missing a quote in the class id attribute?

InfinitiesLoop
no thats not the problem.. when I place same code in a PHP page and press refresh of browser.. every thing works fine.. the problem is in replacing the div contents with innerHTML property..
Ummar
@Ummmar It's still missing ;)
Justin Johnson
+3  A: 

The problem may be hidden in the All flash movie code part... :P Flash embedding is tricky, there is many different way to embed it leading to different result. That's why ppl use libraries instead of writing plain html/js.

The most popular and standard way to embed Flash is to use swfObject. Or you use jQuery, there is flashembed from jQuery Tools.

Both of them works in all major browsers, able to handle things like flashVars, embed params etc.

Andy Li
Ok thats great... but will you let me know that what is the trick invloved in doing this???
Ummar
"the trick invloved", you mean using swfObject or its inner workings? For both of these you may check out swfObject's code generator http://code.google.com/p/swfobject/downloads/list
Andy Li
the JQuery tools help me a lot.. thanks
Ummar