Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-12-2007, 01:07 PM   PM User | #1
mauzzzie
New Coder

 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
mauzzzie is an unknown quantity at this point
Internet Explorer insert div and flash into body

Hi, i am trying to insert a div with a flash object inside into a page. but would really like to do it in a dom proper way. i have this code so far:

Code:
var sCreative='<div id="hockeystick"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="100%"><param name="movie" value="http://www.dqatestsite.nl/test/hockeystick.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="SCALE" value="exactfit" /><embed src="http://www.dqatestsite.nl/test/hockeystick.swf" width="100%" height="100%" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" scale="exactfit"></embed></object></div>';
document.body.innerHTML = document.body.innerHTML + sCreative;
this is some very messy code, but i did not know where to begin at first so i justed started trying some stuff. Does anybody know a proper way to do this?
mauzzzie is offline   Reply With Quote
Old 01-12-2007, 04:55 PM   PM User | #2
TripperTreats
New Coder

 
TripperTreats's Avatar
 
Join Date: Oct 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
TripperTreats is an unknown quantity at this point
Yes. Check out SWFObject.

http://blog.deconcept.com/swfobject/

It was created to solve (among other things) exactly this issue. All you do is make a div tag with html, and then use a line or two of javascript to write the flash object into it. Once you use it, you will never go back. See my website for examples of how this is done:

www.trippertreats.com

After reading that link above (SWFObject), you will have downloaded a .js file and included it in your header. Then, all you would have to do in your case is this:

Code:
<div id="hockeystick"></div>
<script>
var swfHockey = new SWFObject("http://www.dqatestsite.nl/test/hockeystick.swf", "hockey", 100%, 100%, 7, #000000);
swfHockey.addParam("quality","high");
swfHockey.addParam("wmode","transparent");
swfHockey.addParam("scale","exactfit");
swfHockey.write('hockeystick');
</script>
Let me know how this works out for you and if you have any other questions about it. As you can see, it's much simpler. For additional options, check out

http://www.adobe.com/cfusion/knowled...fm?id=tn_12701

Happy Flashing,
__________________
Psychedelic digital art at www.trippertreats.com.

"And in the end, the love you take
is equal to the love you make
."
TripperTreats is offline   Reply With Quote
Old 01-15-2007, 09:40 AM   PM User | #3
mauzzzie
New Coder

 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
mauzzzie is an unknown quantity at this point
Ah, yes, thanks a lot. this totally works out for me! thank you!
mauzzzie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:48 PM.


Advertisement
Log in to turn off these ads.