Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Access an element that is present in a embed object

Access an element that is present in a embed object

Scheduled Pinned Locked Moved Web Development
javascripthtmldatabasehelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cdpace
    wrote on last edited by
    #1

    Hello, I have the following file called index.html

    and this code in another file called test.svg

    <svg width="100%" height="100%"
    xmlns="http://www.w3.org/2000/svg">

    <rect id="mytestrectangle" width="300" height="100"
    style="fill:rgb(255,0,255);stroke-width:1;
    stroke:rgb(0,0,255);fill-opacity:0.9;"/>

    <polygon points="0,0 100,100 170,250 20,10"
    style="fill:#cccccc;
    stroke:#000000;stroke-width:1"/>

    </svg>

    now what i am tring to do is from the file index.html try to access the element called "mytestrectangle" that is in the file test.svg. But I am incliding this file in index.html via the embed object. Is there a way I can access that element via javascript from the index.html page?

    hope i expained clear what i need.

    Thank you in advance for the help.

    L 1 Reply Last reply
    0
    • C cdpace

      Hello, I have the following file called index.html

      and this code in another file called test.svg

      <svg width="100%" height="100%"
      xmlns="http://www.w3.org/2000/svg">

      <rect id="mytestrectangle" width="300" height="100"
      style="fill:rgb(255,0,255);stroke-width:1;
      stroke:rgb(0,0,255);fill-opacity:0.9;"/>

      <polygon points="0,0 100,100 170,250 20,10"
      style="fill:#cccccc;
      stroke:#000000;stroke-width:1"/>

      </svg>

      now what i am tring to do is from the file index.html try to access the element called "mytestrectangle" that is in the file test.svg. But I am incliding this file in index.html via the embed object. Is there a way I can access that element via javascript from the index.html page?

      hope i expained clear what i need.

      Thank you in advance for the help.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Well, I do not found any way to access elements that reside in file you have used in embed tag. However, you can access embed object as whole like

      A Circle
      
      A Square
      
      <!--
      document.write(document.embeds.length," embedded objects.");
      //or you can access specific element like
      //if you want to access embed object circle then you can use 
      //document.embeds\[0\] or document.embeds\["circle"\]
      -->
      

      HTH

      Jinal Desai - LIVE Experience is mother of sage....

      C 1 Reply Last reply
      0
      • L Lost User

        Well, I do not found any way to access elements that reside in file you have used in embed tag. However, you can access embed object as whole like

        A Circle
        
        A Square
        
        <!--
        document.write(document.embeds.length," embedded objects.");
        //or you can access specific element like
        //if you want to access embed object circle then you can use 
        //document.embeds\[0\] or document.embeds\["circle"\]
        -->
        

        HTH

        Jinal Desai - LIVE Experience is mother of sage....

        C Offline
        C Offline
        cdpace
        wrote on last edited by
        #3

        thx

        L 1 Reply Last reply
        0
        • C cdpace

          thx

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          My Pleasure.

          Jinal Desai - LIVE Experience is mother of sage....

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups