window.open (width и height)
Как изменить скрипт так, чтоб размеры width и height были в процентах или высчитывались под размер экрана.
<script> function newMyWindow(e) { var h = 800, w = 1200; window.open(e, '', 'scrollbars=1,height='+Math.min(h, screen.availHeight)+',width='+Math.min(w, screen.availWidth)+',left='+Math.max(0, (screen.availWidth - w)/2)+',top='+Math.max(0, (screen.availHeight - h)/2)); } </script> |
Попробуй так если я правильно понял "под размер экрана"
<h2 onclick="newMyWindow('http://javascript.ru/')">Test</h2> <script> function newMyWindow(e) { var h = window.innerHeight, w = window.innerWidth; window.open(e, '', 'scrollbars=1, ' + 'height=' + h + ',' + 'width='+ w); } </script> |
ealexseen,
:) <a href="#" onclick="newMyWindow('http://javascript.ru/')">Test</a> <script> function newMyWindow(e) { var h = window.outerHeight, w = window.outerWidth; window.open(e, '', 'scrollbars=1, ' + 'height=' + h + ',' + 'width='+ w); } </script> |
Часовой пояс GMT +3, время: 10:25. |