powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / clientWidth равен нулю а не должен
2 сообщений из 2, страница 1 из 1
clientWidth равен нулю а не должен
    #36216461
recvezitor1
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
<div class="mFrame_right">
	<div style="float: left;">
		<!--@News:Image-->
	</div>
	<style type="text/css">
	
.scrollbar80 {
height:400px;
left:400px;
position:absolute;
top:10px;
width:15px;
}
.scrollup80 {
cursor:pointer;
height:13px;
left: 0 ;
position:absolute;
top: 0 ;
width:13px;
}
.scrolldown80 {
cursor:pointer;
height:13px;
left: 0 ;
position:absolute;
top:200px;
width:13px;
}
</style>

<script type="text/javascript" language="javascript">


var _scrollTxt = null;

function content_height(scrollTxt, scrollBar) {
    _scrollTxt = scrollTxt;

    var objText = document.getElementById(scrollTxt);
    var objScroller = document.getElementById(scrollBar);
    if (objText == null || objText == 'undefined') {
        objScroller.style.display = "none";
        return;
    }

    var status = objScroller.style.display;
    if (status == "block") {
        return;
    }

    var f = function() {
        var divHeight = objText.clientHeight >  0  ? objText.clientHeight : objText.offsetHeight;
        var divScrollHeight = objText.scrollHeight;


        if (divScrollHeight && divHeight) {
            if (divScrollHeight > divHeight) {
                //alert(scrollTxt + " needs scrolling ");
                objScroller.style.display = "block";
                clearInterval(int_id);
            } else {
                //alert(scrollTxt + " no scrolling ");
                objScroller.style.display = "none";
                clearInterval(int_id);
            }
        }
    };
    var int_id = setInterval(f,  100 );
}

var step =  10 ;
var timerDown;
var timerUp;
function scrollDown(id) {
var theContent= document.getElementById(id);
 theContent.scrollTop = theContent.scrollTop + step;
    timerDown = setTimeout("scrollDown('" + id + "')",  10 );
}
function scrollUp(id) {
    document.getElementById(id).scrollTop -= step;
    timerUp = setTimeout("scrollUp('" + id + "')",  10 );
}

function clearScroll() {
    if (window.timerUp) {
        clearTimeout(timerUp);
    }
    if (window.timerDown) {
        clearTimeout(timerDown);
    }
}


</script> 

	<p class="white"/>
	<p class="paddingFrame txt_14 yellow">THE Nieuws</p>
	<div id="news_content_right666" class="paddingFrame txt_14" >
		<div id="news_txt_<!--@News:ID-->" class="newsitemholder" style="float: right; padding-left: 4px;">
			<span class="txt_12 white">
				<!--@News:Date.ShortDate-->
				<span class="yellow">
					<!--@News:Heading-->
				</span>
			</span>
			<br/><br/>
			<span class="txt white">
				<!--@News:Text-->
			</span>
		</div>	
	</div>
	<div id="scrollbar1" class="scrollbar80">
        <div id="scrollup1" class="scrollup80" onmousedown="scrollUp('news_content_right666')" onmouseout="clearTimeout(timerUp)"><img alt="Scroll up" src="/Files/system/buttons/up.png"></div>
        <div id="scrolldown1" class="scrolldown80" onmousedown="scrollDown('news_content_right666')" onmouseout="clearTimeout(timerDown)"><img alt="Scroll down" src="/Files/system/buttons/down.png"></div>
	</div>
    <script type="text/javascript">content_height('news_content_right666','scrollbar1');</script>
</div>


вот такой код должен скроллить дивчик. Но он не скролит, потому что в методе content_heightcontent_height тут

var divHeight = objText.clientHeight > 0 ? objText.clientHeight : objText.offsetHeight;
var divScrollHeight = objText.scrollHeight;


if (divScrollHeight && divHeight) {
...


не проходит проверку и всегда равен нулю.


Че за нафиг? Рядом совсем работает на ура.
Собственно вопрос когда clientHeight и offsetHeight может быть равен нулю?
...
Рейтинг: 0 / 0
clientWidth равен нулю а не должен
    #36227564
Korcar
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
при
Код: plaintext
1.
  display: none;
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / clientWidth равен нулю а не должен
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]