Dark Wizard
Гуру форума
- Регистрация
- 23 Сен 2007
- Сообщения
- 194
- Реакции
- 80
- Автор темы
- #1
Не пойму почему вариант
	
	
	
		
работает, а вариант
	
	
	
		
не работает, хотя я только изменил название функции с reset на reset6
P.S. да и если вообще reset на любое другое название поменять почему-то не работает.
	
		
			
		
		
	
				
			
		Код:
	
	Один выбор из нескольких
<form id="form" name="form" method="POST">
          <input type="hidden" name="clan_help_id" value=""><span class="comment">Выберите один вариант:</span><br><br>
          <script>function reset(currentid, replacetext){
          if (currentid != 0) { form.elements.selectedoption[0].value = replacetext; }
          if (currentid != 1) { form.elements.selectedoption[1].value = replacetext; }
          if (currentid != 2) { form.elements.selectedoption[2].value = replacetext; }
          if (currentid != 3) { form.elements.selectedoption[3].value = replacetext; }
          }</script>
<table class="datatable" border="1" cellspacing="0" cellpadding="4">
  <tr>
    <td><input id="selectedoption[0]" name="selectedoption[0]" type="number" value="0" min="0" onfocus="reset(0,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[0]">дуб</label></td>
  </tr><input type="hidden" name="optionlabel[0]" value="дуб">
  <tr>
    <td><input id="selectedoption[1]" name="selectedoption[1]" type="number" value="0" min="0" onfocus="reset(1,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[1]">берёза</label></td>
  </tr><input type="hidden" name="optionlabel[1]" value="берёза">
  <tr>
    <td><input id="selectedoption[2]" name="selectedoption[2]" type="number" value="0" min="0" onfocus="reset(2,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[2]">ель</label></td>
  </tr><input type="hidden" name="optionlabel[2]" value="ель">
  <tr>
    <td><input id="selectedoption[3]" name="selectedoption[3]" type="number" value="0" min="0" onfocus="reset(3,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[3]">ясень</label></td>
  </tr><input type="hidden" name="optionlabel[3]" value="ясень">
</table>
</form>работает, а вариант
		Код:
	
	Один выбор из нескольких
<form id="form" name="form" method="POST">
          <input type="hidden" name="clan_help_id" value=""><span class="comment">Выберите один вариант:</span><br><br>
          <script>function reset6(currentid, replacetext){
          if (currentid != 0) { form.elements.selectedoption[0].value = replacetext; }
          if (currentid != 1) { form.elements.selectedoption[1].value = replacetext; }
          if (currentid != 2) { form.elements.selectedoption[2].value = replacetext; }
          if (currentid != 3) { form.elements.selectedoption[3].value = replacetext; }
          }</script>
<table class="datatable" border="1" cellspacing="0" cellpadding="4">
  <tr>
    <td><input id="selectedoption[0]" name="selectedoption[0]" type="number" value="0" min="0" onfocus="reset6(0,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[0]">дуб</label></td>
  </tr><input type="hidden" name="optionlabel[0]" value="дуб">
  <tr>
    <td><input id="selectedoption[1]" name="selectedoption[1]" type="number" value="0" min="0" onfocus="reset6(1,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[1]">берёза</label></td>
  </tr><input type="hidden" name="optionlabel[1]" value="берёза">
  <tr>
    <td><input id="selectedoption[2]" name="selectedoption[2]" type="number" value="0" min="0" onfocus="reset6(2,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[2]">ель</label></td>
  </tr><input type="hidden" name="optionlabel[2]" value="ель">
  <tr>
    <td><input id="selectedoption[3]" name="selectedoption[3]" type="number" value="0" min="0" onfocus="reset6(3,'0');" class="short"> шт.</td>
    <td><label for="selectedoption[3]">ясень</label></td>
  </tr><input type="hidden" name="optionlabel[3]" value="ясень">
</table>
</form>не работает, хотя я только изменил название функции с reset на reset6
P.S. да и если вообще reset на любое другое название поменять почему-то не работает.
 
				 
 
		