Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Formularz > type="image" zamiast submit, zamiana zwykłuch przycisków w formularzu na graficzne
Fixer
post
Post #1





Grupa: Zarejestrowani
Postów: 123
Pomógł: 0
Dołączył: 24.10.2004
Skąd: TG

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


Witam, mam następujący problem.

Mam formularz, działa on dobrze pod IE7 i pod FF.
Ale gdy zamiast zwykłego przycisku
  1. <input type="submit" name="button" id="button" value="Submit" />

chcę wstawić grafikę
  1. <input name="btn_wyslij" type="image" value="btn_wyslij" onfocus="blur()"
  2. onmouseover="this.src='./images/btn/btn_wyslij_on.gif';
  3. style.cursor='pointer'" onmouseout="this.src='./images/btn/btn_wyslij_off.gif'"
  4. src="images/btn/btn_wyslij_off.gif" alt="Wyślij" />


to pod FF formularz działa dobrze a pod IE7 już nie (button wyślij już nie działa) (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

Tak wygląda u mnie sprawdzanie czy przycisk został wciśnięty:
  1. <?php
  2. if (isset($_REQUEST["btn_wyslij"])) { 
  3. ...
  4. }
  5. ?>


jak znowusz zrobię przycisk w ten sposób:
  1. <input name="btn_wyslij" type="submit" value="" style="border: 0;
  2. background: url('images/btn/btn_wyslij_off.gif');
  3. background-repeat: no-repeat; margin-bottom: 4px; width: 69px; height: 21px;"
  4. onfocus="blur()" onmouseover="this.src='./images/btn/btn_wyslij_on.gif';
  5. style.cursor='pointer'"
  6. onmouseout="this.src='./images/btn/btn_wyslij_off.gif'"
  7. src="images/btn/btn_wyslij_off.gif" alt="Wyślij" />


to nie zmienia się grafika przycisku po najechaniu na niego myszką (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

Jest jakiś sposób na rozwiązanie tego problemu?
Pozdrawiam.

Ten post edytował Fixer 27.08.2007, 23:48:20
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Fixer
post
Post #2





Grupa: Zarejestrowani
Postów: 123
Pomógł: 0
Dołączył: 24.10.2004
Skąd: TG

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


hmm dobry pomysł sobieh (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
w międzyczasie wpadłem na coś równie ciekawego...

Jest to efekt rollover w css, znalazłem to tutaj, polecam: http://perfectionorvanity.com/2006/08/15/g...rmularzy-w-css/

Odpowiedni obrazek dla przycisku ściągnięcie z tąd: http://riddle.pl/-/xhtml/css-gfx-input/img2.png

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  4. <title>Untitled Document</title>
  5. </head>
  6.  
  7. <style type="text/css">
  8. #image input, #submit input {
  9. display: block;
  10. }
  11.  
  12. #submit input {
  13. background: transparent url(btn_wyslij.gif) 0 0 no-repeat;
  14. border: none;
  15. cursor: pointer;
  16. height: 21px;
  17. max-height: 21px;
  18. padding-top: 40px;
  19. width: 69px;
  20. }
  21.  
  22. #reset input {
  23. background: transparent url(btn_wyczysc.gif) 0 0 no-repeat;
  24. border: none;
  25. cursor: pointer;
  26. height: 21px;
  27. max-height: 21px;
  28. padding-top: 40px;
  29. width: 88px;
  30. }
  31.  
  32. #submit input:hover, #reset input:hover {
  33. background-position: 0 -21px;
  34. }
  35.  
  36. #submit input:active, #reset input:active {
  37. background-position: 0 -42px;
  38. }
  39.  
  40. </head>
  41.  
  42.  
  43. <form id="formularz" name="formularz" method="post" action="">
  44. <table width="300" border="0" cellspacing="0" cellpadding="0">
  45. <tr>
  46. <td width="80" align="right">Imię:</td>
  47. <td width="10" rowspan="2">&nbsp;</td>
  48. <td><input name="imie" type="text" id="imie" size="20" /></td>
  49. </tr>
  50. <tr>
  51. <td align="right">Nazwisko:</td>
  52. <td><input name="nazwisko" type="text" id="nazwisko" size="20" /></td>
  53. </tr>
  54.  
  55. <table width="300" border="0" cellspacing="0" cellpadding="0">
  56. <tr>
  57. <td width="90" height="25">&nbsp;</td>
  58. <td width="3"><div id="submit"><input type="submit" name="submit" value="Wyślij" /></div></td>
  59. <td width="10">&nbsp;</td>
  60. <td><div id="reset"><input type="reset" name="reset" value="Wyczyść" />
  61. </div></td>
  62. </tr>
  63. </form>
  64.  
  65. </body>
  66. </html>


PS problem rozwiązany, dzięki za wasze sugestie, w działaniu można zobaczyć to tutaj: http://fixer.devtown.net/valid/index.php

Ten post edytował Fixer 28.08.2007, 07:37:11
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: 13.10.2025 - 06:14