I am creating a web-page that has other pages nested inside of one main HTML file. So far, I have managed to get a working tab system in for its navigation menu, but instead of showing internal <div>
content when a tab is selected, I want it to display another HTML page I have created.
I am trying to avoid using <iframe>
if at all possible as I feel it wont be useful in the long-run. I have attempted to find an alternative, but I have been unable to so far.
I am working with JavaScript, HTML5, and CSS- so I would appreciate help that includes these languages, not JQuery.
If you don't want to use JQuery or iframes , I suggest you use html object tag .
Create 2 HTML
files. In my example, one.html and two.html
one.html
<div id="display"></div>
<script>
function load_anotherpage() {
document.getElementById("display").innerHTML='<object type="text/html" data="two.html"></object>';
}
load_anotherpage();
</script>
two.html
<h1>Hello</h1>
document.write("Copyright Lifewire, all rights reserved.");
includes/copyright.js
<script type="text/javascript" src="includes/copyright.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.