index.html PHP: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=cp-1251"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <a href="#" onclick="document.getElementById('wind').style.display='block'; return false;">Открыть окно</a> <div id="wind"> <button type="button" value="закрыть" onclick="document.getElementById('wind').style.display='none'; return false;"> закрыть</button> </div> </body> </html> style.css PHP: a { text-decoration:none; color:#03508c; font-weight:bold; font-size:16px; } #wind { position: absolute; width:320px; left: 35%; top: 100px; border:solid #105a98 4px; display: none; z-index: 10; overflow: hidden; background-color:#348c03; color:#fff; text-align:center; padding:10px; } Сразу сорри за дурацкий вопрос! Как не нажимая <a href="#" onclick="document.getElementById('wind').style.display='block'; return false;">Открыть окно</a> окошко сразу появлялось на странице! СПС!
Code: <html> <body onload='document.getElementById("wind").style.display="block"'> </body> </html> или Code: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=cp-1251"> <link rel="stylesheet" href="style.css" type="text/css"> <script type="text/javascript"> document.getElementById("wind").style.display="block"; </script> </head> <body> <div id="wind"> <button type="button" value="закрыть" onclick="document.getElementById('wind').style.display='non e'; return false;"> закрыть</button> </div> </body> </html>
PHP: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=cp-1251"> <link rel="stylesheet" href="style.css" type="text/css"> <script type="text/javascript"> document.getElementById("wind").style.display="block"; </script> </head> <body> <div id="wind"> <button type="button" value="закрыть" onclick="document.getElementById('wind').style.display='non e'; return false;"> закрыть</button> </div> </body> </html> Можешь еще раз ответь почему у меня <script type="text/javascript"> document.getElementById("wind").style.display="block"; </script> Вот эта часть не пашет???
Она работает ровно так, как должна. Непонятно только, зачем вообще этот код, если достаточно в стилях поменять Code: display: none; на Code: display: block;
Code: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>О,кошко</title> <style> .wind { position: absolute; width: 320px; left: 35%; top: 100px; border: #105a98 solid 4px; display: block; z-index: 10; overflow: hidden; background-color: #348c03; color: #fff; text-align:center; padding: 10px; } </style> </head> <body> <div class="wind">Удивительно</div> </body> </html>