File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I open a PopUp using a html template ?

 
Max Tomlinson
Ranch Hand
Posts: 365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "template page"?
 
Max Tomlinson
Ranch Hand
Posts: 365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic