I'm new to JavaScript and trying to learn. How can I open the same window multiple times using JavaScript? Also, it didn't work when I changed the function name.
Here is the function:
<script type='text/javascript'>
function window(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=800,left = 650,top = 250');");
}
</script>
Try something like this:
var numWindows = 0;
var windows = new Array(100);
var parameters = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=800,left = 650,top = 250";
function openNewWindow(url) {
numWindows += 1;
var title = "Window #"+numWindows;
windows[numWindows] = window.open(url, title, parameters);
}
To access the windows, do this:
windows[num]
where num is the id of the window. The first id is 1, the second is 2, and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With