сss (9) сss3 (14) ajax (2) css (42) drupal (7) Fix IE6 (4) font (4) html (23) javascript (22) jQuery (15) js (5) less (1) php (1) scss (1) soft (2) vue (1) webstorm (1) wordpress (1)

Картинка в новом окне

<script>

function imgopen(imgf,tit){
rand_id='image'+(Math.round(Math.random()*1000));

outf="<html>"
 +"<head>"
 +"<title>"+title+"</title>"
 +"<style>body{margin:0px}</style>"
 +"</head>"
 +"<body leftmargin=0 topmargin=0>"
 +"<img src=\""+imgf+"\">";

iopen="iwin=self.open('"+imgf+"', '"+rand_id+"', 
'width='+(img1.width)+',height='+(img1.height)+',
 top=0, left=0');"
 +"iwin.document.write('"+outf+"');"
 +"iwin.focus();";

img1=new Image();
img1.src=imgf;

if(img1.width!=0) eval(iopen);

else{
iwin = self.open('about:blank', 'f'+rand_id, 
'width=100,height=100,top=0,left=0');
iwin.document.write("<html>"
+"<body>Загрузка...
"
 +"<"+"script>"
  +"function imo(img1){"+iopen
  +"self.close();"
 +"}<"+"/script>"
 +"<img src='"+imgf+"' onload='imo(this);'>");
 }
}
</script>
<br /> <p><i>Пример работы:</i><br /> <a href="javascript:imgopen('images/01.jpg','Photo')"><br /> <img src="images/photo_small.jpg" /></a><br />


Вот такой вариант...