insertAdjacentHTML and removeChild 
Author Message
 insertAdjacentHTML and removeChild

Hi folks

Do Netscape and other browsers support

mydiv.insertAdjacentHTML("BeforeEnd",htmltagstring) and also

childelement = mydiv.children(nameofelement)
mydiv.removechild(childelement)

Also, using
if (window[someelementname])

to check existence of element

I use these to dynamically add/remove html

Thanks and Season's Greetings.........

Justin Dutoit

PS Do you have to say document.  before referencing an element in Netscape?
In caps? I'm looking for a reference....  Ta



Sat, 14 Jun 2003 06:36:12 GMT  
 insertAdjacentHTML and removeChild
NN6 has similar features:
  <DIV ID="mydiv">...</DIV>
is scripted as
  var mydiv = document.getElementById('mydiv');
You can then navigate the document subtree with
  mydiv.nextSibling
  mydiv.previousSibling
  mydiv.firstChild
  mydiv.lastChild
  mydiv.childNodes
e.g.
  mydiv.removeChild(mydiv.lastChild)
To insert HTML in the document tree you need to parse it first into a
document fragment:
  var range = document.createRange();
  range.setStartAfter(mydiv.lastChild);
  var documentFragment = range.createContextualFragment(htmlstring));
which you can then insert into the document tree
  mydiv.appendChild(documentFragment);

To check for the existence of an IDed element you check
  var el;
  if ((el = document.getElementById('elementID'))
    // script el

Quote:

> Hi folks

> Do Netscape and other browsers support

> mydiv.insertAdjacentHTML("BeforeEnd",htmltagstring) and also

> childelement = mydiv.children(nameofelement)
> mydiv.removechild(childelement)

> Also, using
> if (window[someelementname])

> to check existence of element

> I use these to dynamically add/remove html

> Thanks and Season's Greetings.........

> Justin Dutoit

> PS Do you have to say document.  before referencing an element in Netscape?
> In caps? I'm looking for a reference....  Ta

--

        Martin Honnen
        http://javascript.faqts.com/
        http://home.t-online.de/home/martin.honnen/jsgoddies.html



Fri, 13 Jun 2003 23:08:32 GMT  
 insertAdjacentHTML and removeChild

Quote:
> Hi folks

> Do Netscape and other browsers support

> mydiv.insertAdjacentHTML("BeforeEnd",htmltagstring) and also

In addition to Martins reply, I would like to point out that an
emulation of insertAdjacentHTML() has been made for NS6.

http://www.faqts.com/knowledge_base/view.phtml/aid/5756/fid/128

--
Thor Larholm



Sat, 14 Jun 2003 00:02:25 GMT  
 insertAdjacentHTML and removeChild
Thankyou.
Do the window[elname] and insertAdjacentHTML and div.removeChild work in the
syntax I used, in both browsers then?

Justin


Quote:


> > Hi folks

> > Do Netscape and other browsers support

> > mydiv.insertAdjacentHTML("BeforeEnd",htmltagstring) and also

> In addition to Martins reply, I would like to point out that an
> emulation of insertAdjacentHTML() has been made for NS6.

> http://www.faqts.com/knowledge_base/view.phtml/aid/5756/fid/128

> --
> Thor Larholm



Sat, 14 Jun 2003 17:27:46 GMT  
 insertAdjacentHTML and removeChild

Quote:

>Hi folks
>Do Netscape and other browsers support
>mydiv.insertAdjacentHTML("BeforeEnd",htmltagstring) and also

    no. And I am quite astonished what it has to do
    with core JS. IMHO DOM related questions are more
    apropiate to ask for example in

microsoft.public.windows.internetexplorer.ie5.programming.dhtml.scripting

Quote:
>In caps? I'm looking for a reference....

MM anno MM
promoting his "educational" masterpiece
http://my.tele2.ee/cadorsoft/links2PROJECT6.htm
(115K huge dhtml related links... no Opera5 links currently)


Sun, 15 Jun 2003 05:32:48 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. removeChild() leaving blank space

2. IE4 removeChild or equiv

3. write script into another frame with innerHTML/insertAdjacentHTML

4. insertAdjacentHTML Questions...

5. HELP: InsertAdjacentHTML Problem

6. insertadjacenthtml of object to trigger autodownload...

7. insertAdjacentHTML Method

8. insertAdjacentHTML

9. Invalid target element for this operation / insertAdjacentHTML

10. Cross Browser insertAdjacentHTML() ??

11. using asp var in "insertAdjacentHtml"

 

 
Powered by phpBB® Forum Software