Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript] wyswitalanie encji
lucks
post 2.07.2009, 18:08:38
Post #1





Grupa: Zarejestrowani
Postów: 143
Pomógł: 0
Dołączył: 5.04.2005

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


witam

po wyswitaleniu zmiennej
  1. var src =index.php?Id="+Id+"&ProductId="+ProductId;

dostaje:
  1. index.php?Id=1&ProductId=1;


jak się pozbyc encji (&) z adresu?
Go to the top of the page
+Quote Post
Pawel_W
post 2.07.2009, 18:15:21
Post #2





Grupa: Zarejestrowani
Postów: 1 675
Pomógł: 286
Dołączył: 15.06.2009
Skąd: Wieliczka

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


chcesz usunąć &amp czy zamienić na &?
Go to the top of the page
+Quote Post
lucks
post 2.07.2009, 18:18:17
Post #3





Grupa: Zarejestrowani
Postów: 143
Pomógł: 0
Dołączył: 5.04.2005

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


zaminić na & oczywiscie
Go to the top of the page
+Quote Post
Pawel_W
post 2.07.2009, 18:21:32
Post #4





Grupa: Zarejestrowani
Postów: 1 675
Pomógł: 286
Dołączył: 15.06.2009
Skąd: Wieliczka

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


pokaż ten skrypt, bo u mnie działa normalnie

w php użyłym tego htmlspecialchars_decode" title="Zobacz w manualu PHP" target="_manual, ale w js nie mam pojęcia co daje taki sam efekt
Go to the top of the page
+Quote Post
lucks
post 2.07.2009, 18:30:05
Post #5





Grupa: Zarejestrowani
Postów: 143
Pomógł: 0
Dołączył: 5.04.2005

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


  1. <script language="Javascript">//<![CDATA[
  2.  
  3. var Id = 'Id';
  4. var ProductId = 'ProductId';
  5.  
  6. Id = gup(Id);
  7. ProductId = gup(ProductId);
  8. document.getElementById('if_gen').src = "index.php?Id="+Id+"&ProductId="+ProductId;
  9. function gup( name )
  10. {
  11. name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  12. var regexS = "[\\?&]"+name+"=([^&#]*)";
  13. var regex = new RegExp( regexS );
  14. var results = regex.exec( window.location.href );
  15. if( results == null )
  16. return "";
  17. else
  18. return results[1];
  19. }
  20. //]]></script>
  21. <iframe id='if_gen' src='' width='750' height='620' style='border:0px; padding: 0px; background-color: #F4F4F4;' scrolling="no"></iframe>


Ten post edytował lucks 2.07.2009, 18:30:49
Go to the top of the page
+Quote Post
kamil4u
post 2.07.2009, 19:34:53
Post #6





Grupa: Zarejestrowani
Postów: 2 350
Pomógł: 512
Dołączył: 4.01.2009
Skąd: Wrocław / Świdnica

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


http://www.w3schools.com/jsref/jsref_unescape.asp a jak nie pomoże: http://www.webtoolkit.info/javascript-url-decode-encode.html


--------------------
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: 29.06.2025 - 12:50