Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]Zmiana zawartości
sher
post
Post #1





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 9.07.2014

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


  1. function up(id) {
  2. if (document.getElementById('up'+id).style.color == "black" && document.getElementById('down'+id).style.color == "black"){
  3. document.getElementById('up'+id).style.color = "green";
  4. document.getElementById('up'+id).style.BorderColor = "green";
  5. var ids = document.getElementById('rate'+id);
  6. parseInt(ids);
  7. return ids.innerHTML = ids+1;
  8. }
  9. }


Jak w elemencie jest cyfra 0, i powinno zmienić się na 1, to zamiast tego pojawia się "[object HTMLSpanElement]1". Jak pozbyć się tego tekstu przed jedynką?

Ten post edytował sher 3.04.2015, 13:54:33
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
IProSoft
post
Post #2





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

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


Chyba brakuje Ci tego
[JAVASCRIPT] pobierz, plaintext
  1. var ids = parseInt( document.getElementById('rate'+id).innerHTML );
  2. document.getElementById('rate'+id).innerHTML = ids + 1;
[JAVASCRIPT] pobierz, plaintext
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: 23.08.2025 - 19:27