By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

How to open a sub window from another sub window

P: 3
Hi! I am facing a problem here. I wish to open a sub window from another sub window which means when i click on the main parent window a small window will appear then when i click on the button on the small window another smaller window will appear. Thanks in advance. Here is my code:
[HTML]<html>
<head><title>Date Picker</title>
<script language="JavaScript">
var newwindow=undefined;
var editwindow=undefined;
function pop(){
newwindow= window.open("javascript:''","","Height=200,Width=2 00");
if (window.focus) {newwindow.focus()}
newwindow.document.open();
newwindow.document.write("<html><head><title>Choos e Colour</title></head>"+
"<body><form name='tstest'><input type='Text' name='timestamp' value=''>"+
"<img src='cal.gif' width='16' height='16' border='0' alt='Click Here to select the times' >"+
"<input type='button' value='press' onclick=''>"+
"</form></body></html>");
newwindow.document.close();

}

function pop2(){
newwindow.close();
editwindow=window.open("javascript:''","name","hei ght=400,width=620");
if (window.focus) {editwindow.focus()}
editwindow.document.open();
editwindow.document.write("<html><head><title>colo r</title></head><body>hi</body></html>");
editwindow.document.close();
}
</script>
</head>
<body>
<input type="button" name="enter" value="click here" onclick="pop()">

</body>
</html>[/HTML]
Jul 3 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Multiple popups is not a good idea. Are you sure you can't do what you require using DHTML?

Anyway, opening another window from a popup is easy. Just call window.open again as you did for the parent window. Note that this code must go inside the popup window.
Jul 3 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.