Noob Java shit

Status
Not open for further replies.

mattonitto

So not gangster....
Oct 30, 2007
160
3
0
This should be super simple, at least I think.

Here's the goal. Clean window (no scroll bars) same size as image(link) in the center of the browser.

Linking through the image is not a problem, resizing the window is not a problem (in itself.)

Here we go: The window moves to the top left of the browser with scroll bars for both the horizontal and vertical, even though window.resizeTo is the same dimensions as the image. As far as moving goes the best I could come up with are moveTo and moveBy, but those both run off coordinates.

Throw me a freaking bone here.
 


You don't have to give me the answer, you could just point me in the right direction.
 
Code:
 function openPicWindow(imageWidth,imageHeight) { theWindow = window.open('','windowName','width='+imageWidth+',height='+imageHeight+',top='+((screen.availHeight/2)-imageHeight)+',left='+((screen.availWidth/2)-imageWidth)+''); var myWindow = theWindow.document;  myWindow.writeln('[URL="javascript:close()"][IMG]http://www.wickedfire.com/bleh.jpg[/IMG][/URL]');  }
Should be fine as a rough idea. Call in your page with openPicWindow(imageWidth,imageHeight); in a tag or in a function call (javascript:function();). You can set imagewidth/height manually or by passing the details from meta-data or your own data from the image. Pretty basic stuff....
 
function openPicWindow(imageWidth,imageHeight) {
theWindow = window.open('','windowName','scrollbars=0,statusbar=0,toolbar=0,resizable=0,location=0,width='+imageWidth+',height='+imageHeight+',top='+((screen.availHeight/2)-imageHeight)+',left='+((screen.availWidth/2)-imageWidth)+'');
var myWindow = theWindow.document;
myWindow.writeln('{html}{body}{center}{a href="javascript:close();"}{img src="bleh.jpg"}{/a}{/center}{/body}{/html}');
}

Should be fine as a rough idea. Call in your page with openPicWindow(imageWidth,imageHeight); in a tag or in a function call (javascript:function();). You can set imagewidth/height manually or by passing the details from meta-data or your own data from the image. Pretty basic stuff....

Edit: This forum won't let me post code - it keeps formatting to stupidly. NFI why, its not like you can inject JS in a fucking BBcode call. Also, the {} in the writeln are supposed to be <> but forum filters em out.
 
Status
Not open for further replies.