code_junkie

How do I write content to another browser window using Javascript?

Nov 11th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. var myWindow = window.open('...')
  2. myWindow.document.getElementById('foo').style.backgroundColor = 'red'
  3.  
  4. function popUp(){
  5.  
  6. var newWindow = window.open("","Test","width=300,height=300,scrollbars=1,resizable=1")
  7.  
  8. //read text from textbox placed in parent window
  9. var text = document.form.input.value
  10.  
  11. var html = "<html><head></head><body>Hello, <b>"+ text +"</b>."
  12. html += "How are you today?</body></html>"
  13.  
  14.  
  15. newWindow .document.open()
  16. newWindow .document.write(html)
  17. newWindow .document.close()
  18.  
  19. }
Add Comment
Please, Sign In to add comment