
07.12.2007, 12:53
|
|
Познающий
Регистрация: 22.03.2007
Сообщений: 45
Провел на форуме: 110666
Репутация:
9
|
|
Код, попап изображения.
Главное его свойство, это то что нет зазоров в открываемом окне. Фотка выводиться как есть.
Очень удобно. Можно внедрить в PHP, и забыть о том, что фотки открываются в новом окне, или в некрасивом виде.
Код:
/**
Кроссбраузерный JavaScript-код
Проверено в: NN9,FF2&3,Opera,IE7
*/
timeout = 0;
function Start(URL, WIDTH, HEIGHT) {
windowprops = "width=" + (WIDTH+2) + ",height=" + (HEIGHT+2);
text = "<html><head><title>Image</title></head><body bgcolor='#dddddd' style='padding: 1px; margin: 0'";
if (timeout != 0) text +=" onLoad=\"setTimeout('window.close()', " + timeout*1000 + ");\"";
text += "><center><img src='" + URL + "'>";
if (timeout != 0) text +="<br><font face='Tahoma, helvetica' size='-1'>Preview closes after " + timeout + " seconds.</font>";
text += "</center></body></html>";
preview = window.open("", "preview", windowprops);
preview.document.open();
preview.document.write(text);
preview.document.close();
}
вызов функции:
Код:
<a href="javascript:Start('большая_фотка.jpg', 600, 450)";><img src="маленькая_фотка.jpg" alt="Альт"/></a>
|
|
|