| Revision 518,
734 bytes
checked in by jdalbey, 6 years ago
(diff) |
|
paramdemo.html sample js demo added.
|
| Line | |
|---|
| 1 | <HTML> |
|---|
| 2 | <BODY> |
|---|
| 3 | Top of Page |
|---|
| 4 | <script> |
|---|
| 5 | // Demo of how to retrieve URL parameter in javascript |
|---|
| 6 | // Might be useful in ticket #143 |
|---|
| 7 | var items = {}; |
|---|
| 8 | var query = window.location.search.substring(1); |
|---|
| 9 | var parms = query.split("&"); |
|---|
| 10 | // Examine each parameter |
|---|
| 11 | for (var i = 0, max = parms.length; i < max; i++) |
|---|
| 12 | { |
|---|
| 13 | // check for trailing & with no param |
|---|
| 14 | if (parms[i] === "") |
|---|
| 15 | continue; // skip it |
|---|
| 16 | |
|---|
| 17 | var param = parms[i].split("="); |
|---|
| 18 | //console.log("got parm: ",param); |
|---|
| 19 | // If it's valid add it to dictionary |
|---|
| 20 | items[decodeURIComponent(param[0])] = decodeURIComponent(param[1] || ""); |
|---|
| 21 | |
|---|
| 22 | } |
|---|
| 23 | if (items['dotsize'] == "large") |
|---|
| 24 | { |
|---|
| 25 | document.writeln("large"); |
|---|
| 26 | } |
|---|
| 27 | else |
|---|
| 28 | { |
|---|
| 29 | document.writeln("normal"); |
|---|
| 30 | } |
|---|
| 31 | </script> |
|---|
| 32 | </BODY> |
|---|
| 33 | </HTML> |
|---|
Note: See
TracBrowser
for help on using the repository browser.