Как вынуть текст из DIV 
		
		
		
		Привет! 
	Есть html код: <td id="big_td_56"> <div class="inputContainer bigBoxStyleClass"> <img class="noButtonImageUnits switchImage" src="pictures/Units/SwordmanIcon.png"/> <div class="noButtonLabelInput">Солдат2</div> <div id="unitMax1" class="mapMaxButton hoverable"> <div class="iconbutton_left"> <div class="iconbutton_right"> <div class="iconbutton_middle"> <span class="mapMaxValue">MAX</span> </div> </div> </div> </div> <img class="permissionIcon switchImage" src="pictures/Browser/PermissionFalse_Colored.png"/> <input id="unitInput1" class="noButtonInputField unitsInput" type="text" size="10"/> <div class="noButtonInputCount unitsInputCount">999</div> </div> </td> Из него интересует эта часть <input id="unitInput1" class="noButtonInputField unitsInput" type="text" size="10"/> <div class="noButtonInputCount unitsInputCount">999</div> Вопрос: Как вынуть 999 и записать в переменную и знать что это относится или к input id="unitInput1" или <div class="noButtonLabelInput">Солдат2</div> Почему именно к ним? Потому что блоков <td id="big_td_56"> много и они с разными номерами. Буду признателен за помощь.  | 
	
		
 что бы вынуть  
	
var a=document.GetElementByClassName(""noButtonInputCount unitsInputCount").value
в переменной a хранитса 999 а вторую часть вопроса неочень понял,может так?хотя могу тупить... 
var b=document.GetElementById("unitInput1");
b=a;
 | 
	
		
 value относится к input-ам 
	текст дива innerHTML должен вернуть  | 
	
		
 Дело в том, что на самой странице много блоков в которых есть class="noButtonInputCount unitsInputCount". Получается нужно как то искать по двум признакам. Из уникальных есть input id="unitInput1" 
	Получается что нужно найти блок в котором есть input id="unitInput1" и далее найти class="noButtonInputCount unitsInputCount" - и потом как понимаю вынуть уже 999. Запускаю 
var a=document.GetElementByClassName(""noButtonInputCount unitsInputCount").value
Выдает ошибку "Unexpected identifier" Тут точно нужно две "" ? А если с одной " то ошибка: "Object #<HTMLDocument> has no method 'GetElementByClassName'"  | 
	
		
 value вытаскует и текст <div>.innerHTML тоже.В этом я уж точно уверен=) 
	 | 
	
		
 Цитата: 
	
  | 
	
		
 Я нашел похожую тему http://javascript.ru/forum/events/28...iz-div%27.html 
	но в ней все просто - есть уникальный id от DIV, в моем случае сложнее - id от DIV это id блока, который разный постоянно. на разных страницах и блоков много.  | 
	
		
 В firebug пишу команду и выдает вот это: 
	TypeError: Object #<HTMLDocument> has no method 'GetElementByClassName' get stack: function () { [native code] } message: "Object #<HTMLDocument> has no method 'GetElementByClassName'" set stack: function () { [native code] } __proto__: Error  | 
	
		
 Цитата: 
	
 
<div id='test'>text</div>
<script>var text = document.getElementById('test').value;
alert(text); </script>
<div id='test'>text</div>
<script>var text = document.getElementById('test').innerHTML;
alert(text); </script>
 | 
	
		
 так попробуйте 
	
alert(document.getElementById('unitInput1').parentNode.getElementsByClassName('noButtonInputCount unitsInputCount')[0].innerHTML);
 | 
	
		
 Я понимаю что ошибка была в том что указывается Element, а нужно было бы Elements 
	Если так var a = document.getElementsByClassName('noButtonInputCoun t unitsInputCount').value то ошибки нету, но и в переменной нету того что нужно ;( Но я начал читать про getElements раньше не доводилось. Я только начинаю писать на javascripts  | 
	
		
 alert(document.getElementById('unitInput1').parent  Node.getElementsByClassName('noButtonInputCount unitsInputCount')[0].innerHTML);  
	отрабатывает нормально, но выдает 0 вместо 999 =(  | 
	
		
 vadim5june, 
	огромное спасибо!!!! все заработало!! Ура )))  | 
	
		
 Сейчас почитаю про указанные функции. Очень оперативно, очень подробно! Спасибо еще раз всем! =) 
	 | 
	
		
 Цитата: 
	
 
<!DOCTYPE html>
<html>
 <td id="big_td_56">
<div class="inputContainer bigBoxStyleClass">
<img 
class="noButtonImageUnits switchImage" src="pictures/Units/SwordmanIcon.png"/>
<div class="noButtonLabelInput">Солдат2</div>
<div 
id="unitMax1" class="mapMaxButton hoverable">
<div class="iconbutton_left">
<div class="iconbutton_right">
<div class="iconbutton_middle">
<span class="mapMaxValue">MAX</span>
</div>
</div>
</div>
</div>
<img class="permissionIcon switchImage" 
src="pictures/Browser/PermissionFalse_Colored.png"/>
<input id="unitInput1" class="noButtonInputField unitsInput" type="text" size="10"/>
<div class="noButtonInputCount unitsInputCount">999</div>
</div>
</td>
<script>
alert(document.getElementById('unitInput1').parentNode.getElementsByClassName
('noButtonInputCount unitsInputCount')[0].innerHTML);
</script>
 | 
	
		
 Я уже выше написал что все работает! 
	Огромное спасибо за помощь, причем подробную )  | 
| Часовой пояс GMT +3, время: 06:25. |