Autor | Zpráva | ||
---|---|---|---|
megaman Profil |
#1 · Zasláno: 10. 8. 2007, 12:05:23 · Upravil/a: megaman
Ahoj,
Mam následující skript: <SCRIPT type=text/javascript> function OpenImageWindow(imageString, width, height, title){ imageWindow = window.open("", "imgWin", 'toolbar=0,width='+width+',height='+height); imageWindow.document.writeln("<html>"); imageWindow.document.writeln("<he"+"ad><title>"+title+"</title> </he"+"ad>"); imageWindow.document.writeln("<body onclick='window.close();'>"); imageWindow.document.writeln("<p><img title='Kliknutím zavřete okno' src='"+imageString+"' width='"+width+"' height='"+height+"' border='0' /></p>"); imageWindow.document.writeln("</bo"+"dy>"); imageWindow.document.writeln("</ht"+"ml>"); imageWindow.document.bgColor="lightgreen"; imageWindow.document.close(); } </SCRIPT> <a href="2566.jpg" title="Klikni pro zvětšení (popup)" onclick="OpenImageWindow('2566.jpg','1000','667',''); return false;"><img src="Thumbnail_100x100.jpg" /></a> Problem je, ze otevreny obrazek v novem okne se zobrazi spatne. Je odsazeny. Nevite jak nastavit , aby byl presne v novem pop-up okne zarovnany? |
||
Plaváček Profil |
#2 · Zasláno: 10. 8. 2007, 12:10:04
Zkus:
<SCRIPT type=text/javascript> function OpenImageWindow(imageString, width, height, title){ imageWindow = window.open("", "imgWin", 'toolbar=0,width='+width+',height='+height); imageWindow.document.writeln("<html>"); imageWindow.document.writeln("<he"+"ad><title>"+title+"</title> </he"+"ad>"); imageWindow.document.writeln("<body style='margin:0;padding:0' onclick='window.close();'>"); imageWindow.document.writeln("<p style='margin:0;padding:0'><img style='display:block' title='Kliknutím zavřete okno' src='"+imageString+"' width='"+width+"' height='"+height+"' border='0' /></p>"); imageWindow.document.writeln("</bo"+"dy>"); imageWindow.document.writeln("</ht"+"ml>"); imageWindow.document.bgColor="lightgreen"; imageWindow.document.close(); } </SCRIPT> |
||
megaman Profil |
#3 · Zasláno: 10. 8. 2007, 12:12:37
Ten mi nejde vubec :(
|
||
Plaváček Profil |
#4 · Zasláno: 10. 8. 2007, 12:37:51
Tak zkus tento skript, ten funguje:
JS <SCRIPT type=text/javascript> var myTWin = window.myTWin; function OpenMyWin(link,winName,sirka,vyska,popisek) { var retValue=true; if (myTWin!=null && !myTWin.closed) { myTWin.focus(); myTWin.location.href=link.href; } else { myTWin=window.open(link.href,winName,'width='+sirka+',height='+vyska+' ,scrollbars=0,resizable=0,toolbar=0'); myTWin.document.open('text/html'); myTWin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> '); myTWin.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs"> '); myTWin.document.write('<head> '); myTWin.document.write('<meta http-equiv="content-type" content="text/html; charset=utf-8" /> '); myTWin.document.write('<title>'+popisek+'</title> '); myTWin.document.write('<style>body { font:81.25%/1.4 Verdana,sans-serif; margin: 0; padding: 0; text-align: center; } img { border-style: none; }</style> '); myTWin.document.write('</head> '); myTWin.document.write('<body> '); myTWin.document.write("<a href="javascript:window.close('close')"> "); myTWin.document.write('<img src="'+link.href+'"'); myTWin.document.write(' width="'+sirka+'" height="'+vyska+'" alt="'+popisek+'" /></a> '); myTWin.document.write('</body> '); myTWin.document.write('</html>'); myTWin.document.close(); if (myTWin==null || typeof(myTWin)=="undefined") retValue=false; else { link.target=winName; myTWin.focus(); } } return retValue; } </SCRIPT> HTML <a href="obrazek.jpg" title="Klikni pro zvětšení (popup)" onclick="return !OpenMyWin(this,'_okno','1000','667','popis')"><img src="obrazek_maly.jpg" alt="popis" /></a> |
||
Anonymní Profil * |
#5 · Zasláno: 10. 8. 2007, 12:42:46
uz to jede:
<script type="text/javascript"> function OpenImageWindow(imageString, width, height, title){ imageWindow = window.open("", "imgWin", 'toolbar=0,width='+width+',height='+height); imageWindow.document.writeln("<html>"); imageWindow.document.writeln("<he"+"ad><title>"+title+"</title><style> body {margin:0px; padding:0px;}</style></he"+"ad>"); imageWindow.document.writeln("<body onclick='window.close();'>"); imageWindow.document.writeln("<p><img title='Kliknutím zavřete okno' src='"+imageString+"' width='"+width+"' height='"+height+"' border='0' /></p>"); imageWindow.document.writeln("</bo"+"dy>"); imageWindow.document.writeln("</ht"+"ml>"); imageWindow.document.bgColor="lightgreen"; imageWindow.document.close(); } </script> Diky za cas |
||
Časová prodleva: 17 let
|
0