Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [HTML][Java]Zmiana koloru czcionki jednego elementu
senior.pol
post 31.10.2013, 01:21:08
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Witam,
Jak zmienić kolor tylko i wyłącznie znaku "*" na np. kolor czerwony w poniższym kodzie?

Kod
var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+" *";
Go to the top of the page
+Quote Post
klima06
post 31.10.2013, 01:33:06
Post #2





Grupa: Zarejestrowani
Postów: 48
Pomógł: 10
Dołączył: 21.10.2011
Skąd: UK / PL

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




Po prostu musisz dodać kod html do zmiennej?
  1. var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+" <span style=\"color:red;\">*</span>";


Ten post edytował klima06 31.10.2013, 01:33:49
Go to the top of the page
+Quote Post
senior.pol
post 31.10.2013, 13:49:27
Post #3





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Cytat(klima06 @ 31.10.2013, 01:33:06 ) *


Po prostu musisz dodać kod html do zmiennej?
  1. var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+" <span style=\"color:red;\">*</span>";


Coś nie tak, bo zamiast czerwonej gwiazdki jest widoczny kod
  1. <span style="color:red;">*</span>


Ktoś ma pomysł jak temu zaradzić?
Go to the top of the page
+Quote Post
nospor
post 31.10.2013, 13:53:19
Post #4





Grupa: Moderatorzy
Postów: 36 556
Pomógł: 6314
Dołączył: 27.12.2004




To moze pokaz, jak ty ten tenkst gdzies tam wkladasz..... Czemu zawsze trzeba to pisac? Czemu nie mozna sie samemu domyslic, ze wrozki zyją tylko w bajkach?


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

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
senior.pol
post 31.10.2013, 15:36:26
Post #5





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Kod
(function($){

    jQuery.fn.ebcaptcha = function(options){

        var element = this;
        var submit = $(this).find('input[type=submit]');
        $('<label id="ebcaptchatext"></label>').insertBefore(submit);
        $('<input name="captcha" type="text" id="ebcaptchainput"/><br/>').insertBefore(submit);
        var input = this.find('#ebcaptchainput');
        var label = this.find('#ebcaptchatext');
        
        $(element).find('input[type=submit]').attr('disabled','disabled');

        
        var randomNr1 = 0;
        var randomNr2 = 0;
        var totalNr = 0;


        randomNr1 = Math.floor(Math.random()*10);
        randomNr2 = Math.floor(Math.random()*10);
        totalNr = randomNr1 + randomNr2;
        var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+" *";
        $(label).text(texti);
        
    
        $(input).keyup(function(){

            var nr = $(this).val();
            if(nr==totalNr)
            {
                $(element).find('input[type=submit]').removeAttr('disabled');
            }
            else{
                $(element).find('input[type=submit]').attr('disabled','disabled');
            }
            
        });

        $(document).keypress(function(e)
        {
            if(e.which==13)
            {
                if((element).find('input[type=submit]').is(':disabled')==true)
                {
                    e.preventDefault();
                    return false;
                }
            }

        });

    };

})(jQuery);
Go to the top of the page
+Quote Post
tomxx
post 31.10.2013, 19:54:41
Post #6





Grupa: Zarejestrowani
Postów: 172
Pomógł: 27
Dołączył: 5.10.2013

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


[JAVASCRIPT] pobierz, plaintext
  1. var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+'<span style="color:red">'+" *"+'</span>';
[JAVASCRIPT] pobierz, plaintext

Aha, to jest JavaScript, a nie Java wink.gif

Ten post edytował tomxx 31.10.2013, 19:56:29
Go to the top of the page
+Quote Post
senior.pol
post 1.11.2013, 01:37:58
Post #7





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Niestety dalej nie działa. Ciągle zamiast czerownej gwiazdki widać skrypt html

  1. <span style="color:red"> *</span>
Go to the top of the page
+Quote Post
tomxx
post 1.11.2013, 10:24:05
Post #8





Grupa: Zarejestrowani
Postów: 172
Pomógł: 27
Dołączył: 5.10.2013

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


Cytat(senior.pol @ 1.11.2013, 01:37:58 ) *
Niestety dalej nie działa. Ciągle zamiast czerownej gwiazdki widać skrypt html

  1. <span style="color:red"> *</span>

W HTML nie tworzy się skryptów. Chyba że chodzi Ci o kod HTML.
Go to the top of the page
+Quote Post
senior.pol
post 2.11.2013, 00:53:22
Post #9





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Jest na ten problem rozwiązanie?
Go to the top of the page
+Quote Post
com
post 2.11.2013, 00:57:05
Post #10





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


[JAVASCRIPT] pobierz, plaintext
  1. $(label).html(texti);
[JAVASCRIPT] pobierz, plaintext

a reszta jak już pisali
[JAVASCRIPT] pobierz, plaintext
  1. var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+" <span style=\"color:red;\">*</span>";
[JAVASCRIPT] pobierz, plaintext


Ten post edytował com 2.11.2013, 00:57:24
Go to the top of the page
+Quote Post
senior.pol
post 2.11.2013, 02:00:59
Post #11





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Cytat(com @ 2.11.2013, 00:57:05 ) *
[JAVASCRIPT] pobierz, plaintext
  1. $(label).html(texti);
[JAVASCRIPT] pobierz, plaintext

a reszta jak już pisali
[JAVASCRIPT] pobierz, plaintext
  1. var texti = "Ile jest "+randomNr1+" + "+randomNr2+" ?"+" <span style=\"color:red;\">*</span>";
[JAVASCRIPT] pobierz, plaintext


Dzięki, wszystko działa biggrin.gif
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: 27.04.2025 - 07:45