Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]warunek if
Sklep102
post
Post #1





Grupa: Zarejestrowani
Postów: 56
Pomógł: 0
Dołączył: 5.12.2019

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


Cześć,
Nie znam js ale znalazłem takie coś

  1.  
  2. <script type="text/javascript">
  3. $(document).ready(function() {
  4.  
  5. if (window.location.href.indexOf("delete_tag") || ("tag") > -1) {
  6. alert("your url contains the name franky");
  7. }
  8. });
  9. </script>
  10.  



index.php?v=tag

Nie wyświetla komunikatu za to index.php?v=delete_tag jest ok.


Może ktoś wyjaśnić jak zapisać warunek if z OR?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
trueblue
post
Post #2





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

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


A znasz PHP?
Jeśli tak, to analogicznie.


--------------------
Go to the top of the page
+Quote Post
vokiel
post
Post #3





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


Jak myślisz co robi ("tag")?
Czemu pierwszy warunek jest w formie window.location.href.indexOf("delete_tag") a nie samo ("delete_tag")?

A może to w drugim czegoś brakuje...


--------------------
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 Aktualny czas: 20.08.2025 - 11:18