Posted By

pelisalinet on 11/26/10


Tagged

get url javascript variablehtml


Versions (?)

Javascript get


 / Published in: JavaScript
 

URL: http://www.pelisali.net

Shows two variable on the URL. You can change the varibles. text and text2.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html><head><title>Title</title>
  4. <script type="text/javascript">
  5. var site_validator;
  6. var site_url = window.document.URL;
  7. function $_GET(variable){
  8. site_validator = site_url.replace("=","");
  9. site_validator = site_validator.replace("=","");
  10. site_validator = site_validator.split(variable);
  11. for(var i=0; i < site_validator.length; i++){
  12. site_validator[i] = site_validator[i].replace("&","");
  13. }
  14. if(site_validator[1] != ""){
  15. return site_validator[1];
  16. }
  17. }
  18. </script>
  19. </head><body>
  20. <script>
  21. document.write( $_GET('text') + ' ' + $_GET('text2') );
  22. </script>
  23. </body></html>

Report this snippet  

You need to login to post a comment.