SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Open new window with content
-
Jan 19, 2007, 14:58 #1
- Join Date
- Nov 2006
- Posts
- 10
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Open new window with content
Is it possible to open an exsisting window using window.open and then add a button and a text box to that window using javascript, and if so how?
Thanks
-
Jan 19, 2007, 16:13 #2
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yep
Code:<html> <head> <script type="text/javascript"> function newwin() { var w = window.open("about:blank"); var btn = w.document.body.appendChild(w.document.createElement("button")); btn.innerHTML = "click me"; btn.onclick = function () { alert("you clicked me"); } } </script> </head> <body> <button onclick="newwin();">open window</button> </body> </html>
Bookmarks