Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    New Coder TripperTreats's Avatar
    Join Date
    Oct 2006
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    ."

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah, yes, thanks a lot. this totally works out for me! thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •