|
From: Duke on 18 Apr 2008 07:10 <html> <head> <script type="text/javascript"> function init(){ var html = document.open('Hello.html'); document.getElementById('hi").innerHTML = html; } </script> <body onload ="init();"> <did = 'hi'> </d> </body> </html> this code is not working Help me load hello.html page into this index.html page
From: Tom de Neef on 18 Apr 2008 08:16 "Duke" <p.sathish.cs(a)gmail.com> > <html> > <head> > <script type="text/javascript"> > function init(){ > var html = document.open('Hello.html'); > document.getElementById('hi").innerHTML = html; > } > </script> > <body onload ="init();"> > <did = 'hi'> > </d> > </body> > </html> > > this code is not working Help me load hello.html page into this > index.html page Something wrong with your quotes: document.getElementById('hi") -> document.getElementById('hi') Maybe <did = 'hi'> should be'<d id = 'hi'>. And what sort of element is <d> anyway ? Try <p> instead. Rather than loading a html file into an element, would it be a better idea to load the body part? document.getElementById('hi').innerHTML = html.body.innerHTML; Testing is easier when you use onclick instead of onload. In FF+Firebug you should be able then to follow execution. Tom
|
Pages: 1 Prev: Load HTML page into another Next: Date format DD/MM/YYYY |