Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> input type, zmiana obrazka
Thuunder
post 5.12.2004, 12:39:03
Post #1





Grupa: Zarejestrowani
Postów: 234
Pomógł: 1
Dołączył: 29.10.2004

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


Witam!
w formularzu użyłem <input type="image" src="x.gif">
Mam pytanie czy da się zmienić ten obrazek na inny po najechaniu na niego myszką w tym przypadku?
Używałem onMouseOver ale nie działa
Dzięki rolleyes.gif

Ten post edytował Thuunder 5.12.2004, 12:39:52


--------------------
najprostsze rzeczy są najmniej oczywiste
Go to the top of the page
+Quote Post
peterj
post 5.12.2004, 13:37:31
Post #2





Grupa: Zarejestrowani
Postów: 121
Pomógł: 0
Dołączył: 9.02.2004
Skąd: Warszawa

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


Kod
<script type="text/javascript">



function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}
onload=init;

</script>

  1. <img src="photo1.jpg" hsrc="photo2.jpg">


--------------------
Warsztat: Apache 1.3.29 / PHP 4.3.4 / MySQL 3.23.58 / Winsyntax
Go to the top of the page
+Quote Post
Thuunder
post 5.12.2004, 13:48:41
Post #3





Grupa: Zarejestrowani
Postów: 234
Pomógł: 1
Dołączył: 29.10.2004

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


Wiesz co nie działa, próbowałem to jakoś podpiąć,ale nic to nie dało.
Chodzi mi dokładnie o
  1. <input type="image" src="x.gif">


Ale i tak dzięki.

Ten post edytował Thuunder 5.12.2004, 13:49:35


--------------------
najprostsze rzeczy są najmniej oczywiste
Go to the top of the page
+Quote Post
peterj
post 5.12.2004, 14:03:22
Post #4





Grupa: Zarejestrowani
Postów: 121
Pomógł: 0
Dołączył: 9.02.2004
Skąd: Warszawa

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


ops, nieuważnie przeczytałem temat rolleyes.gif


--------------------
Warsztat: Apache 1.3.29 / PHP 4.3.4 / MySQL 3.23.58 / Winsyntax
Go to the top of the page
+Quote Post
Thuunder
post 7.12.2004, 02:13:23
Post #5





Grupa: Zarejestrowani
Postów: 234
Pomógł: 1
Dołączył: 29.10.2004

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


Da się to jakoś zrobić?
  1. <input type="image" src="x.gif">

obrazek x.gif zamienić na y.gif ?


--------------------
najprostsze rzeczy są najmniej oczywiste
Go to the top of the page
+Quote Post
revyag
post 7.12.2004, 08:26:46
Post #6





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

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


Pewnie że się da smile.gif
  1. <input type="image" src="x.jpg" onmouseover="this.src='y.jpg'" onmouseout="this.src='x.jpg'">


--------------------
-------------

------
Go to the top of the page
+Quote Post
Thuunder
post 7.12.2004, 21:22:28
Post #7





Grupa: Zarejestrowani
Postów: 234
Pomógł: 1
Dołączył: 29.10.2004

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


biggrin.gif Świetnie exclamation.gif!!!!
Dzięki exclamation.gif!


--------------------
najprostsze rzeczy są najmniej oczywiste
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 30.06.2025 - 13:03