Показать сообщение отдельно

  #9  
Старый 14.12.2007, 02:00
astrologer
Постоянный
Регистрация: 30.08.2007
Сообщений: 773
Провел на форуме:
3069349

Репутация: 808


По умолчанию

Цитата:
Сообщение от k1b0rg  
А нахрен определять браузер? getElementById работает во всех браузерах.
Цитата:
If there is more than one element with id="test", the method selects the first in the document. All others are ignored.
IE also returns the element with name="test".
Наверное, поэтому.
По-моему, лучше использовать просто ссылку на элемент:
Код:
<html>
<head>
<script type="text/javascript">

function toggle(e){
    if(!e) return;
    e.style.visibility = (e.style.visibility!='hidden' ? 'hidden':'visible');
}

</script>

<style type="text/css">

div {
    border:gray solid 1px;
    background-color:#DCDCDC;
    width: 100px;
    height: 75px
}

div+div { border-top:none }

</style>
</head>
<body>
	<div onclick="toggle(this.nextSibling)">&nbsp;</div><div>&nbsp;</div>
</body>
</html>
 
Ответить с цитированием