Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][JavaScript][PHP] ukrywanie części treści na stronie
adam2907
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 7.02.2018

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


w jaki sposób można zrobić coś takiego jak jest na gumtree.pl na stronie danego ogłoszenia

ze nie jest pokazywany cały numer telefonu, tylko jego cześć a dopiero po kliknięciu "pokaz caly numer" pokazuje sie cały numer
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Neutral
post
Post #2





Grupa: Zarejestrowani
Postów: 286
Pomógł: 46
Dołączył: 10.01.2016

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


Chociażby tak:

  1. <div id="phone_number">123456789</div>


Kod
var phone_number = document.getElementById("phone_number");
var arr = [phone_number.innerHTML];
function foo(){
    if(phone_number.innerHTML.length==arr[0].length){
        var range = 3;
    }else{
        var range = arr[0].length
    }
    phone_number.innerHTML = arr[0].substring(0,range);
    
}
phone_number.addEventListener('click',foo,false);


http://www.forumweb.pl/poczatkujacy-webmas...ghlight=#534042

Zobacz sobie kod użytkownika @Chess, na tę chwilę ten ostatni post (07.05.2018 23:52).
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: 12.10.2025 - 06:13