Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.00 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.     <body onLoad="runScript()">
  5.         <h1>TTS script</h1>
  6.        
  7.         <script type="text/javascript" src="jquery-3.2.1.min.js">
  8.        
  9.             function runScript()
  10.             {
  11.                 document.getElementById('demo').innerHTML = "done something";
  12.                 var paramval = getURLParameter("q");
  13.                
  14.                 /*
  15.                 if(window.jQuery) { document.getElementById('demo').innerHTML = "jquery is enabled"; }
  16.                 else { document.getElementById('demo').innerHTML = "jquery is not enabled"; }
  17.                 */
  18.                
  19.                 if(!paramval)
  20.                 {
  21.                     window.location.hash = "#queryparamnotparsed";
  22.                     return;
  23.                 }
  24.                
  25.                 window.location.hash = "#" + paramval;
  26.             }
  27.            
  28.             function getURLParameter(name)
  29.             {
  30.                 // From stackoverflow.com/questions/11582512
  31.                 var regex = new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)');
  32.                 return decodeURIComponent((regex.exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
  33.             }
  34.            
  35.         </script>
  36.        
  37.         <p id="demo"></p>
  38.     </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement