Netmechanik
05-14-2003, 12:01 AM
I have written this code but just cant get the thing to work. I want to create popup windows that display in different places according to the viewers resolution. I need help please! If i change the function to document.write() it displays the correct values, so i take it there is no problem there, but when i add the function newWindow it diplays at width=0 height=0 no matter what res i run at
********************************************
The code:
var width = screen.width;
var res =(((!(640-width))*1)+((!(800-width))*2)+((!(1024-width))*3)+((!(1152-width))*4)+((!(1280-width))*5)+((!(1600-width))*6));
if(!(res)) res = 1;
// 640x480 code goes here
if (res=='1') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=,top=0,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
// 800x600 code goes here
if (res=='2') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=88,top=50,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
// 1024x768 code goes here
if (res=='3') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=200,top=120,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
// 1152 & 1280 & 1600 code goes here
if (res=='4' || res=='5' || res=='6') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=300,top=150,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
//all other resolutions
if (res!='1' && res!='2' && res!='3' && res!='4' && res!='5' && res!='6') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=0,top=0,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
******************************
I would appreciate it if anybody has any ideas
Clive
********************************************
The code:
var width = screen.width;
var res =(((!(640-width))*1)+((!(800-width))*2)+((!(1024-width))*3)+((!(1152-width))*4)+((!(1280-width))*5)+((!(1600-width))*6));
if(!(res)) res = 1;
// 640x480 code goes here
if (res=='1') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=,top=0,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
// 800x600 code goes here
if (res=='2') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=88,top=50,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
// 1024x768 code goes here
if (res=='3') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=200,top=120,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
// 1152 & 1280 & 1600 code goes here
if (res=='4' || res=='5' || res=='6') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=300,top=150,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
//all other resolutions
if (res!='1' && res!='2' && res!='3' && res!='4' && res!='5' && res!='6') {
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'left=0,top=0,width=625,height=460,toolbar=no,scrollbars=no,resizable=yes')
winContent.focus()
}
}
******************************
I would appreciate it if anybody has any ideas
Clive