Открыть окно в центре экрана
Как можно открыть окно строго по центру экрана, не отталкиваясь от абсолютных координат?
<a href='#' onclick="window.open('window.html','newwin','top=100, left=100, menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, width=600, height=300')">Открыть</a>
|
<a href="javascript://" onclick="_open( '/forum', 300 , 300 );">
Ссылка
</a>
<script type="text/javascript">
function _open( url, width, height ) {
window.open( url, '', 'width=' + width + ',height=' + height + ',left=' + ((window.innerWidth - width)/2) + ',top=' + ((window.innerHeight - height)/2) );
}
</script>
|
exec, Спасибо! Почему я не могу поднять вам карму? До вас я поднимал кому-то еще.
|
| Часовой пояс GMT +3, время: 19:01. |