SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Create an object on the fly

    I have a select with a OnChange Function. I would like to know how to create a different object depending on the selection on the Select.

    Example:

    MySelect have Option 1 and Option 2, so

    If (Myselect.value == Option 1)
    {Create Object 1}
    If (Myselect.value == Option 2)
    {Create Object 2}


    I'm using the object under <body> and it's working, but when I'm trying to use it under a <script> does not work.

    This is the object I'm trying to create: (It is a map) so what I'm trying is to change the values or map depending on the selection of the Select.



    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="900" height="600" id="zoom_map" align="top">
    <param name="movie" value="us_albers.swf?data_file=senate.xml" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#FFFFFF" />
    <embed src="us_albers.swf?data_file=senate.xml" quality="high" bgcolor="#FFFFFF" width="100" height="100" name="Clickable U.S. Map" align="top"
    type="application/x-shockwave-flash"
    pluginspage="http://www.macromedia.com/go/getflashplayer">
    </embed>
    </object>


    Thank you very much

  2. #2
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are okay and familiar with jquery this is pretty much easy. Just use append function on jquery and you are done.

    e.g.

    $('#somediv').append('<object .......... </object>');


Bookmarks

Posting Permissions

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