I need to display a table in a new window. when I click on a button, I got the values displayed in the same window but in a fresh page. I want the values in a new window instead of same window but in a fresh page. The below function gives the table for an array called num which is in the same htm file where are all the other functions are. As I need to use this num Array, I cannot write the code in a new file and call the url in the window.open method. Is there a way where I could write the code for the new window in the same htm file and just make the values display in a new window when I click the button. I tried window.open but that it not working. Could some one help me with this.

num=new Array();
function display(){
for(var i=0;i<data.length;i++)
var str = num[i].toString();
var strSplit =  str.split(",");
document.write("<table border='1'>");
for(var j=0;j<strSplit.length;j++)


<input type="button" name="entries" value="Display" onClick="display()">

Edited by cutekate: n/a

6 Years
Discussion Span
Last Post by mohanrajit.88

Use window.open fn in javascript.

Pass these values as a query string to the new window.And display the values there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.