css - How to add a html file into another html file? -
lets pretend i've html file - "main.html" & html file "content.html"
i want add content on main. made content,
content's - width = window.innerwidth || root.clientwidth || body.clientwidth; height = window.innerheight || root.clientheight || body.clientheight; content absolute. , don't know height width of main.
in main added in body part -
& happen - enter image description here here can content & texts main..
the problem content appears own scroll bar..
what do...!?
to dynamically load content, make ajax call using xmlhttprequest().
in example url passed loadpage() function, in loaded content returned.
<!doctype html> <html lang="en"> <head> <script type="text/javascript"> function loadpage(href) { var xmlhttp = new xmlhttprequest(); xmlhttp.open("get", href, false); xmlhttp.send(); return xmlhttp.responsetext; } </script> </head> <body> <div onclick="document.getelementbyid('bottom').innerhtml = loadpage('content.html');">home</div> <div id="bottom"></div> </body> </html> when div element containing text of "home" clicked, sets html of div element id of "bottom" content found in "hello-world.html" document @ same relative location.
content.html
<p>your content</p>
Comments
Post a Comment