PDA

View Full Version : Javascript no margin



Macro-design
July 4th, 2005, 01:10 PM
Hi,

I'm trying to create all sorts of different flash stuff, and I'm loading these images, but vertically there isn't enough space for them, so I was planning on creating a popup window with the image, whenever pressed. So, I just used the great code for launching a popup window, here from Kirupa - http://www.kirupa.com/developer/mx/centered_popup.htm

Now, everything works just fine, the popup window appears, with the right image, and everything, the only problem is, that I'm going code it, so the popup window can't be scaled, and there is a margin on the image. So there's some white space, and some of the image is cut off.

Can anyone help me adding some code to the launching pop-up window tutorial, so that there won't be any margins?


btw, what a nice weather :) ( here in Denmark at least )

Macro-design
July 5th, 2005, 05:40 AM
Anyone?

nathan99
July 5th, 2005, 06:13 AM
Ummm, i dont know what sort of page you are opening the pop-up as, however, if its html you would make the body tag of the html show no margin


<body topmargin="0" leftmargin="0" rightmargin="0">

tobijas20
July 5th, 2005, 07:03 AM
You can put the whole code into Flash, but I usually use this code in HTML head:


<SCRIPT type=text/javascript>
function Prozor(Slika,myname,w,h,scroll,res){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left ='+LeftPosition+',scrollbars='+scroll+',resizable= '+res+'';
nWin = window.open("",myname,settings);
nWin.document.open();
nWin.document.write('<html><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
nWin.document.write('<img src="'+Slika+'"></body></html>');
nWin.document.close();
nWin.focus();
}
</SCRIPT>


And this code in Flash:


on (release) {
getURL("javascript:Prozor('somePicture.jpg','Title',460,58 0,'no','no')");
}