aspose file tools*
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
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: 61202
    
  66

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: 61202
    
  66

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: 61202
    
  66

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: 61202
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I open a PopUp using a html template ?