Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][HTML]Cannot call method 'toString' of undefined
pabito
post
Post #1





Grupa: Zarejestrowani
Postów: 77
Pomógł: 4
Dołączył: 14.05.2013

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


Witam
Mam poniższa funkcję, gdy próbuje ja uruchomić otrzymuje error: 'Cannot call method 'toString' of undefined'
jako argyment przekazuje string = 'rgb(244,44,44)';

ogólnie poszukuję skryptu, który zmieni kolor rgb to hex

  1. function componentToHex(c) {
  2. var hex = c.toString(16);
  3. return hex.length == 1 ? "0" + hex : hex;
  4. }
  5.  
  6. function rgb2hex(r, g, b) {
  7. return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
  8. }
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.08.2025 - 02:37