|
30 | 30 | }
|
31 | 31 | </style>
|
32 | 32 |
|
33 |
| -<script> |
34 |
| -// Parse the URL parameter |
35 |
| -function getParameterByName(name, url) { |
36 |
| - if (!url) url = window.location.href; |
37 |
| - name = name.replace(/[\[\]]/g, "\\$&"); |
38 |
| - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
39 |
| - results = regex.exec(url); |
40 |
| - if (!results) return null; |
41 |
| - if (!results[2]) return ''; |
42 |
| - return decodeURIComponent(results[2].replace(/\+/g, " ")); |
43 |
| -} |
44 |
| -// Give the parameter a variable name |
45 |
| -var dynamicContent = getParameterByName('reason'); |
| 33 | +<script src="//code.jquery.com/jquery-1.12.0.min.js"></script> |
| 34 | +<script type="text/javascript"> |
| 35 | + // Parse the URL parameter |
| 36 | + function getParameterByName(name, url) { |
| 37 | + if (!url) url = window.location.href; |
| 38 | + name = name.replace(/[\[\]]/g, "\\$&"); |
| 39 | + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
| 40 | + results = regex.exec(url); |
| 41 | + if (!results) return null; |
| 42 | + if (!results[2]) return ''; |
| 43 | + return decodeURIComponent(results[2].replace(/\+/g, " ")); |
| 44 | + } |
| 45 | + // Give the parameter a variable name |
| 46 | + var dynamicContent = getParameterByName('reason'); |
| 47 | + |
| 48 | + $(document).ready(function() { |
| 49 | + |
| 50 | + // Check if the URL parameter is apples |
| 51 | + if (dynamicContent == 'spam') { |
| 52 | + $('#spam').show(); |
| 53 | + } |
| 54 | + // Check if the URL parameter is oranges |
| 55 | + else if (dynamicContent == 'rude') { |
| 56 | + $('#rude').show(); |
| 57 | + } |
| 58 | + // Check if the URL parameter is bananas |
| 59 | + else if (dynamicContent == 'nosnip') { |
| 60 | + $('#nosnip').show(); |
| 61 | + } |
| 62 | + // Check if the URL parmeter is empty or not defined, display default content |
| 63 | + else { |
| 64 | + $('#default-content').show(); |
| 65 | + } |
| 66 | + }); |
46 | 67 | </script>
|
0 commit comments