This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How can I open a PopUp using a html template ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How can I open a PopUp using a html template ?" Watch "How can I open a PopUp using a html template ?" New topic
Author

How can I open a PopUp using a html template ?

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
I want to use a template page that has two divs which I populate with results and then open the page with window open. Does anyone have an example of how to do this?
thanks
Max
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60738
    
  65

What do you mean by "template page"?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
I want to use a generic page - html, xhtml, whatever - for all of my popup information and pass specific info to the page - in divs or whatever - and then pass the html to window.open.

thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60738
    
  65

You don't pass HTML to a window, when you open the window, you specify the URL of the page to display within it.
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Yes I know that but with window.open I can use an empty URL and write the html dynamically. I want to pick up my template, populate it, then pass it to the document.write method. I don't really want to use DOM if I can help it so that the page can be designed independently.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60738
    
  65

Sounds pretty roundabout and messy to me. Why do you feel the need to jump through such hoops? What is it you are really trying to accomplish?
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Found the answer for anyone that needs to know how to do this:

var popup = window.open("page.htm");
popup.document.getElementById("someDiv").innerHTML = "hi";
popup.document.formName.fieldName.value = "hello";

Max
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60738
    
  65

That doesn't seem remotely like what you were describing. Writing a page into the popup is one thing; accessing elements on it is quite simple as you have found.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How can I open a PopUp using a html template ?
 
Similar Threads
update page content
SPRING query: how to have more than one successview
separation of business and presentation logic
problem in printing the values
Merge Data in MS Word on UNIX platform