CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Showing content from database without page refresh

    To remove an element, use removeChild(). To create new elements you need to use createElement(). To apply attributes, use setAttribute(). To set the element in place, use appendChild();

    Code:
    <script type="text/javascript">
    var objToRemove = document.getElementById('id_of_element');
    document.removeChild(objToRemove);
    
    var theBody = document.getElementsByTagName('body').item(0);
    var newDiv = document.createElement('div');
    newDiv.setAttribute('id', 'the_id_you_want');
    theBody.appendChild(newDiv);
    </script>
    Last edited by PeejAvery; April 10th, 2007 at 09:35 PM.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured