• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Insert a tag in current HTML page

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I insert a tag in current page (i.e. without opening new page) on performing some task like onclick/onmouseover etc. If I do document.write it opens a new page. I want to show that tag in current page at particular point between two tags. Any clue how to do this.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

All things are possible with DOM . . . You can use the document.createElement('tagtype') method to create a new tag. Then you just set all its attributes and append it as a child to the parent node to make it appear in the page.
But this is all a lot of work. Does the tag have to be brand new? Maybe the best way to simulate this is to write the tag in the page, and set its style to "display:none." Then you can change the style to "display:block" or "display:inline" as appropriate and the element will appear on the page.
 
V Srinivasan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats great Chris,
Thanks for your post. Can you pls tell me where I can get specifications for DOM.
Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic