Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Podmiana obrazków w polu imput, jak to zrobić?
pc5
post
Post #1





Grupa: Zarejestrowani
Postów: 61
Pomógł: 0
Dołączył: 10.03.2005

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


Witam!

Mam takie pole :

  1. <input class="none" type="image" src="images/szukaj_sm.gif" ALT="szukaj" NAME="szukaj1" border=0>


Jest to po prostu obrazek lupki, po nacisnieciu ktorego rozpoczynamy wyszukiwanie, jest on czescia pewnego formularza. Czy da sie zrobic podmienianie obrazkow przy najechaniu kursorem na ten "obrazko-submit"? Próbowałem ale nic mi nie zadziałało.

Pozdrawiam - KM
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mario
post
Post #2





Grupa: Zarejestrowani
Postów: 186
Pomógł: 0
Dołączył: 23.09.2003
Skąd: Siemianowice Śląskie

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


Rollover Submit Image

Najpierw skopiuj ten skrypt JAVA:

  1. <script TYPE="text/javascript">
  2. <!--
  3. // copyright 1999-2001 Idocs, Inc. http://www.idocs.com/tags/
  4. // Distribute this script freely, but keep this
  5. // notice with the code.
  6. var submitRolls = new Object();
  7.  
  8. function submitroll(src, oversrc, name)
  9. {
  10. this.src=src;
  11. this.oversrc=oversrc;
  12. this.name=name;
  13. this.alt="Submit Query";
  14. this.write=submitroll_write;
  15. }
  16.  
  17. function submitroll_write()
  18. {
  19. var thisform = 'document.forms[' + (document.forms.length - 1) + ']';
  20. submitRolls[this.name] = new Object();
  21. submitRolls[this.name].over = new Image();
  22. submitRolls[this.name].over.src = this.oversrc;
  23. submitRolls[this.name].out = new Image();
  24. submitRolls[this.name].out.src = this.src;
  25.  
  26. document.write
  27. (
  28. '<A onMouseOver="if (document.images)document.images['' + this.name + "'].src=submitRolls['" + this.name + ''].over.src"' +
  29. ' onMouseOut="if (document.images)document.images['' + this.name + "'].src=submitRolls['" + this.name + ''].out.src"' +
  30. ' HREF="javascript:'
  31. );
  32.  
  33. if (this.sendfield)
  34. {
  35. if (! this.sendvalue)
  36. this.sendvalue = 1;
  37. document.write(thisform, ".elements['", this.sendfield, "'].value='", this.sendvalue, "';");
  38. }
  39.  
  40. document.write(thisform + '.submit();void(0);"');
  41. if (this.msg)document.write(' onClick="return confirm('' , this.msg, '')"');
  42. document.write('>');
  43.  
  44. document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '" BORDER=0 NAME="' + this.name + '"');
  45. if (this.height)document.write(' HEIGHT=' + this.height);
  46. if (this.width)document.write(' WIDTH=' + this.width);
  47. if (this.otheratts)document.write(' ' + this.otheratts);
  48. document.write('></A>');
  49. if (this.sendfield)
  50. {
  51. document.write('<INPUT TYPE=HIDDEN NAME="' + this.sendfield + '">');
  52. document.forms[document.forms.length - 1].elements[this.sendfield].value='';
  53. }
  54. }
  55.  
  56. //-->


i robisz formularz z tego:

  1. <FORM ACTION="../cgi-bin/mycgi.pl">
  2. email: <INPUT NAME="email">
  3.  
  4. <script TYPE="text/javascript">
  5. <!--
  6. var sr = new submitroll("submit.out.gif","submit.over.gif","mysubmit");
  7. sr.write();
  8. //-->
  9.  
  10. <INPUT TYPE=SUBMIT VALUE="Go!">
  11.  
  12. </FORM>
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: 3.10.2025 - 01:50