Click to See Complete Forum and Search --> : pop win size


catchup
10-20-2003, 02:13 PM
I have many html pages that the content in all of them is in a table. Can it bepossible to pop-win a window that open to the size of the table in the html? so i don't have to fiddle with the size attribute of the window open script.

Thanks

Jona
10-20-2003, 11:31 PM
This seems to work, but I haven't tested it in Netscape...


<script type="text/javascript"><!--
ie = (navigator.appName=="Internet Explorer")?false:true;
var winObj = window.open("","winObj","width=400,height=400");
winObj.document.write('<table border="2">\n<tr><th>One</th>\n<th>Two</th>\n</tr>\n<tr><td>1</td>\n<td>2</td>\n</tr>\n</table>');
w = (ie)?document.body.clientWidth:winObj.innerWidth;
width = winObj.document.getElementsByTagName("TABLE")[0].width - w;
h = (ie)?document.body.clientHeight:winObj.innerHeight;
height = winObj.document.getElementsByTagName("TABLE")[0].height - h;
winObj.resizeBy(width, height);
//--></script>


[J]ona