Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobieranie danych z klikniecia w obrazek ajax
teez
post
Post #1





Grupa: Zarejestrowani
Postów: 186
Pomógł: 6
Dołączył: 20.12.2010

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


Witam,

Chciałbym się dowiedzieć w jaki sposób pobierane jest ID z takiego wyboru jak tu:

  1. <script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  2.  
  3. <form action="here" method="post">
  4. <div id="sMale" style="display:none;">
  5.  
  6.  
  7. <img src="{$this->settings['public_dir']}gp/skins/2.png" class="skins" id="2" style="margin-top: 3px;" />
  8. <img src="{$this->settings['public_dir']}gp/skins/2.png" class="skins" id="3" style="margin-top: 3px;" />
  9. <img src="{$this->settings['public_dir']}gp/skins/2.png" class="skins" id="4" style="margin-top: 3px;" /></div>
  10. <input type="hidden" name="skin" id="sid" value=""><br />
  11. <div align="center"><input type='submit' class='input_submit' value='Submit' /></div>
  12.  
  13. </form>
  14. <script type="text/javascript">
  15. jQuery(".skins").click( function () { if( jQuery("#sid").val() != jQuery(this).attr("id")){ jQuery(".skins").fadeTo("fast", 0.33); jQuery(this).fadeTo("fast", 1); jQuery("#sid").val( jQuery(this).attr("id") ); } else { jQuery(".skins").fadeTo("slow", 1); jQuery("#sid").val(""); } });
  16.  
  17. jQuery("#charsex").change( function () { if(jQuery(this).val() == '1') { jQuery("#sMale").show("slow"); jQuery("#sFemale").hide("slow"); } else if (jQuery(this).val() == '0') { jQuery("#sFemale").show("slow"); jQuery("#sMale").hide("slow"); } else { jQuery("#sMale").hide("slow"); jQuery("#sFemale").hide("slow"); } });
  18. </script>
  19.  



W jaki sposób mogę pobrać jaki 'id' został wybrany?
Go to the top of the page
+Quote Post

Posty w temacie


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.12.2025 - 10:36