Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][JavaScript]select i akcja na input
robos85
post
Post #1





Grupa: Zarejestrowani
Postów: 466
Pomógł: 11
Dołączył: 21.09.2006
Skąd: Szczecin

Ostrzeżenie: (0%)
-----


Mam taki kod JS:
  1. window.onload=Load;
  2.  
  3. function Load(){
  4. document.forms['compose_form'].reciever.enabled=true;
  5. }
  6. function check_reciever(){
  7. var form_compose=document.getElementById('friends_list');
  8. var selIndex=form_compose.selectedIndex;
  9. if form_compose.options[selIndex].value!=0{
  10. document.forms['compose_form'].reciever.disabled=true;
  11. }
  12. else{
  13. document.forms['compose_form'].reciever.enabled=true;
  14. }
  15. }

i form :
  1. <form action="/inbox" method="post" name="compose_form">
  2. <div style="width:565px;">
  3. <div style="float:left;width:52px;min-width:52px;text-align:left;padding-top:5px;">
  4. Do:
  5. </div>
  6. <div style="float:left;width:300px;">
  7. <input type="text" name="reciever" style="width:295px;" />
  8. </div>
  9. <div style="float:left;text-align:right;width:213px;">
  10. <select style="width:180px;" id="friends_list" onchange="check_reciever()">
  11. <option value="0">----------</option>
  12. <option value="1">11111111</option>
  13. <option value="2">22222222</option>
  14. <option value="3">33333333</option>
  15. </select>
  16. </div>
  17. </div>
  18. <div style="width:565px;clear:both;padding-top:10px;">
  19. <div style="float:left;width:52px;text-align:left;padding-top:5px;">Temat:</div>
  20. <div style="float:left;width:513px;"><input type="text" name="reciever" style="width:513px;" /></div>
  21. </div>
  22. <div style="width:565px;clear:both;padding-top:10px;">
  23. <div style="float:left;width:52px;text-align:left;">
  24. Treść:
  25. </div>
  26. <div style="float:left;width:513px;">
  27. <textarea style="width:513px;height:200px;"></textarea>
  28. </div>
  29. </div>
  30. <div style="width:565px;clear:both;padding-top:10px;text-align:right;">
  31. <button style="width:96px;height:24px;border:none;background:url(../images/send_button.png) no-repeat;"></button>
  32. </div>
  33. </form>


I gdy wybieram jakąś opcję z selecta, pole input nie przyjmuje atrybutu "disabled".
Co skopałem?
Go to the top of the page
+Quote Post

Posty w temacie
- robos85   [HTML][JavaScript]select i akcja na input   17.09.2008, 10:17:42
- - UNK   Koddocument.forms['compose_form']....   17.09.2008, 10:25:21
- - robos85   nie, chodzi mi głównie o to, że nie działa nic naw...   17.09.2008, 10:26:07
- - Czapla   a nie powinno być [HTML] pobierz, plaintext var s...   17.09.2008, 10:28:24
|- - robos85   Cytat(Czapla @ 17.09.2008, 11:28:24 )...   17.09.2008, 10:33:55
- - nevt   nie ma osobno właściwości enabled i disabled - jes...   17.09.2008, 10:36:21
- - robos85   Kodwindow.onload=Loadform; function Loadform...   17.09.2008, 10:38:37
- - UNK   Napisałem wyżej w moim poście, ale chyba już nikt ...   17.09.2008, 10:43:47
- - drPayton   @nevt napisał dość wyraźnie, ale powtórzę: [HTML] ...   17.09.2008, 10:45:20
|- - robos85   Cytat(drPayton @ 17.09.2008, 11:45:20...   17.09.2008, 10:49:29
- - drPayton   [HTML] pobierz, plaintext function check_reciever...   17.09.2008, 11:04:20
- - robos85   EDIT: zmianiam cały js kod na: Kodwindow.onload=L...   17.09.2008, 11:04:38
- - drPayton   Wyżej w moim poście masz odpowiedź   17.09.2008, 11:06:39
- - robos85   Śmiga Tylko czemu nie mogę się od...   17.09.2008, 11:10:07
- - drPayton   Jeśli masz tylko jedno pole o nazwie 'receiver...   17.09.2008, 11:13:35
- - Shili   Jednak moim zdaniem lepiej jest skorzystać z setAt...   17.09.2008, 11:22:01
- - drPayton   @Shili: Uzasadnij proszę. Z chęcią ...   17.09.2008, 11:34:21
- - Shili   Bardziej eleganckie. I profesjonalne. Skoro atrybu...   17.09.2008, 11:41:38


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 04:14