In this JavaScript window object Tutorial, we will open a new browser window. We will see how to specify width and height along with other features.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<!DOCTYPE html> <head> <Title> Java Script Windows </Title> </head> <body> <Script type="text/javascript"> function OpenWindow() { var url = document.getElementById("Url").value; var width = document.getElementById("Width").value; var height = document.getElementById("Height").value; var Winspecs = "width=" + width + "," + "height=" + height + "," + "status, titlebar, resizable" window.open(url,"Navigated", Winspecs); } </Script> <input type="text" style="width: 300px;" id="Url" value="https://www.google.com" /> <input type="text" id="Height" value="400" /> <input type="text" id="Width" value="650" /> <input type="button" value="Open Window" onclick="OpenWindow()" /> </body> </html> |
Categories: JavaScript-Tube