|
-
Possible to import a page?
Is it possible to import an external webpage into an existing one using java script. I was trying
Code:
<script type="text/javascript">
function setPage(page){
document.location.href = page+"?lang=en";
}
</script>
<p>some text</p>
<p>
<a href="#" onclick="setPage('page.html')">click me</a>
</p>
But that ends up being like a redirect, i'm looking for something like <c:import url="page.html"/> but I can't use jsp.
-
I don't know of a way unsing JS, you might want to look at SSI if that's available.
-
The only way JavaScript can do it is if you have an IFRAME or wish to use Ajax.
-
 Originally Posted by phpnovice
The only way JavaScript can do it is if you have an IFRAME or wish to use Ajax.
like this?
Code:
<script type="text/javascript">
function setPage(page){
window.test.src = page;
}
</script>
<a href="#" onclick="setPage('d.html')">click me</a>
<p>some text</p>
<iframe src="" name="test" id="test">
</iframe>
I tried that, get no errors, but nothing happens
-
This:
window.test.src = page;
should be this:
self.frames["test"].location.href = page;
-
thanks i think i have everything working correctly now
-
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks