Webprogramming made easy
www.jojoxx.net

Bild i popup-fönster 3

 

Exempel

Visa bild

Script

<script type="text/javascript">
/* Detta script finns att hämta på http://www.jojoxx.net och
   får användas fritt så länge som dessa rader står kvar. */

function imgPopup3(url){
	MyWin = window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100");
	with(MyWin.document){
	open();
	write("<ht"+"ml>\n<he"+"ad><scr"+"ipt>");
	write("window.onresize=function(){if(document.getElementById){\ndocument.getElementById('myimg').style.width=(document.all)?document.body.clientWidth:window.innerWidth;\ndocument.getElementById('myimg').style.height=(document.all)?document.body.clientHeight:window.innerHeight;\n}}\n");
	write("awidth=(document.layers)?0:8;awidth+=(document.all)?4:0;aheight=(document.layers)?0:29;</scr"+"ipt>\n<title>Bildvisare</title>\n</head>\n<body onLoad=\"window.resizeTo(document.images[0].width+awidth,document.images[0].height+aheight)\"marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:hidden;\">\n");
	write("<img id='myimg' src=\""+url+"\">\n");
	write("</body>\n</html>\n");
	close();
	}
}
</script>
<a href="../../images/calvin/CHANI30.GIF" onClick="imgPopup3(this.href); return false;">Visa bild</a>

Kommentar

Detta script stretchar även bilden för att passa fönstret om du ändrar storleken på det.

Tillbaks