Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   Помогите с javascript (https://forum.antichat.xyz/showthread.php?t=144367)

kdk 29.09.2009 11:47

Помогите с javascript
 
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 код:

{
   
text-decoration:none;
   
color:#03508c;
   
font-weight:bold;
   
font-size:16px;
}

#wind {
       
positionabsolute;
    
width:320px;
    
left35%;
      
top100px;
    
border:solid #105a98 4px;
    
displaynone;
      
z-index10;
    
overflowhidden;
    
background-color:#348c03;
    
color:#fff;
    
text-align:center;
    
padding:10px;


Сразу сорри за дурацкий вопрос!
Как не нажимая <a href="#" onclick="document.getElementById('wind').style.dis play='block'; return false;">Открыть окно</a> окошко сразу появлялось на странице!
СПС!

preda1or 29.09.2009 11:50

Код:

<html>
    <body onload='document.getElementById("wind").style.display="block"'>
    </body>
</html>

или

Код:

<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>


kdk 29.09.2009 11:54

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="blo ck";
</script>
Вот эта часть не пашет???

kdk 29.09.2009 12:40

Может подскажите????

astrologer 29.09.2009 13:32

Цитата:

Сообщение от kdk
Можешь еще раз ответь почему у меня
<script type="text/javascript">
document.getElementById("wind").style.display="blo ck";
</script>
Вот эта часть не пашет???

Она работает ровно так, как должна. Непонятно только, зачем вообще этот код, если достаточно в стилях поменять
Код:

display: none;
на
Код:

display: block;

kdk 29.09.2009 19:36

Все равно у меня не появляеться окошко при загрузке!=((

astrologer 29.09.2009 19:43

Код:

<!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>



Время: 09:21