Nieuw lid |
|
je kan dit via javascript doen:
<head>
<title>javascript include</title>
<!-- dit tussen de head tags -->
<script type="text/javascript">
function Include(id, url) {
var req = false;
// For Safari, Firefox, and other non-MS browsers
if (window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch (e) {
req = false;
}
} else if (window.ActiveXObject) {
// For Internet Explorer on Windows
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
req = false;
}
}
}
var element = document.getElementById(id);
if (!element) {
alert("Bad id " + id +
"passed to Include." +
"You need a div or span element " +
"with this id in your page.");
return;
}
if (req) {
// Synchronous request, wait till we have it all
req.open('GET', url, false);
req.send(null);
element.innerHTML = req.responseText;
} else {
element.innerHTML =
"Sorry, your browser does not support " +
"XMLHTTPRequest objects. This page requires " +
"Internet Explorer 5 or better for Windows, " +
"or Firefox for any system, or Safari. Other " +
"compatible browsers may also exist.";
}
}
</script>
</head>
<!-- standaard home.html laten laden -->
<body onload="Include('includeone', 'home.html');">
<!-- enkele links, zonder page reload tonen -->
<a href="#" onclick="Include('includeone', 'link.html')">link</a>
<!-- de div -->
<div id="includeone"> </div>
</body>
</html>
<head> <title>javascript include</title> <!-- dit tussen de head tags --> <script type="text/javascript"> function Include(id, url) { var req = false; // For Safari, Firefox, and other non-MS browsers if (window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch (e) { req = false; } } else if (window.ActiveXObject) { // For Internet Explorer on Windows try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { req = false; } } } var element = document.getElementById(id); if (!element) { alert("Bad id " + id + "passed to Include." + "You need a div or span element " + "with this id in your page."); return; } if (req) { // Synchronous request, wait till we have it all req.open('GET', url, false); req.send(null); element.innerHTML = req.responseText; } else { element.innerHTML = "Sorry, your browser does not support " + "XMLHTTPRequest objects. This page requires " + "Internet Explorer 5 or better for Windows, " + "or Firefox for any system, or Safari. Other " + "compatible browsers may also exist."; } } </script> </head> <!-- standaard home.html laten laden --> <body onload="Include('includeone', 'home.html');"> <!-- enkele links, zonder page reload tonen --> <a href="#" onclick="Include('includeone', 'link.html')">link</a> <!-- de div --> <div id="includeone"> </div> </body> </html>
hopelijk is dit wat duidelijk en helpt het je. Ik weet niet zeker of het dat is, want snap je eigenlijk niet zo goed wat je juist wilt. |