Communicating with a New Window : Window : Window Browser JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Window Browser » Window »

 

Communicating with a New Window



<html>
<head>
<title>Recipe 6.6</title>
<script type="text/javascript">
var newWindow;
function go_to_demo() {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open("","sub","status,height=200,width=300");
        setTimeout("writeToWindow()"50);
    else if (newWindow.focus) {
        newWindow.focus();
    }
}
function writeToWindow() {
    var newContent = "<html><head><title>Secondary  Window</title></head>";
    newContent += "<body><h1>This is a script-created window.</h1>";
    newContent += "</body></html>";
    newWindow.document.write(newContent);
    newWindow.document.close();
}
</script>
</head>
<body>
<h1>Communicating with a New Window</h1>
<hr /> 
<form>
<input type="button" value="Create New Window" onclick="go_to_demo();" />
</form>
</body>
</html>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Window Browser
» Window