jQuery in Action, 2nd edition*
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript window.location DIV?" Watch "Javascript window.location DIV?" New topic
Author

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 window.open) 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">

Cheers

KS
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: Javascript window.location DIV?
 
Similar Threads
Javascript call AFTER redirect?
javascript code is not called in jsp page
Link question
Re: Servlet Navigation Problem
JSP Forward