BiH


switch Lista naslova:

#61 13.09.2019-09:10
zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,979


Subject: Citanje GET parametra
DownloadIzvorni kod (HTML):
  1. <TITLE>Title of your page</TITLE>
  2.  <script type="text/javascript">
  3. <!--
  4. /******************************************************************/
  5. /* funkcija za citanje ged parametra
  6. /* ulazni parametar je naziv get parametra
  7. /* vraca vrijednost get parametra
  8. /******************************************************************/
  9. function GET_url(name) {
  10.    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
  11.    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
  12.    var res = regex.exec(location.search);
  13.    return res === null ? '' : decodeURIComponent(res[1].replace(/\+/g, ' '));
  14. }
  15. //-->
  16. </HEAD>
  17. <!--   u ovom primjeru parametar se zove id -->
  18.   <script type="text/javascript">
  19. <!--
  20. document.write(GET_url('id'));
  21. //-->
  22. </BODY>
  23. </HTML>

Pozdrav
↑  ↓

Stranice (5): 1, 2, 3, 4, 5


All times are GMT +01:00. Current time: 15.10.2019-17:09.