This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Javascript window.location DIV? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript window.location DIV?" Watch "Javascript window.location DIV?" New topic

Javascript window.location DIV?

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys

Just wondering can you have a Javascript function that uses something like the window.location to open a html page in a div?

The reason we need this is we have a current system that uses a url to redirect to a page that used to appear in a popup (using but now the powers that be want page to appear within the current page, so I was thinking of a div (simulated popup) who would be made visible (easy to do) that displayed the html. I tried the window.location command but that redirect to a new page (just displaying the html)

So as I say, is there a way of doing something like "window.location = url" targets <div id="myId">


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

You can;t just shove an entire page of markup into a <div> and expect it to work. You'll either need to refactor the "included page" to be an HTML fragment that's legal to place within a <div> and use Ajax to fetch the fragment, or use an iframe to house the page.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Javascript window.location DIV?
It's not a secret anymore!