送信元のhtml
html
1<!DOCTYPE html>
2<html lang="ja">
3<head>
4 <meta charset="UTF-8">
5 <title>Document</title>
6</head>
7<body>
8 <form action="遷移先.html" method="get">
9 <select name="time">
10 <option value="30">30 秒</option>
11 <option value="60">60 秒</option>
12 <option value="90">90 秒</option>
13 </select>
14 <input type="submit" value="Start">
15 </form>
16</body>
17</html>
送信先のhtml
html
1<!DOCTYPE html>
2<html lang="ja">
3<head>
4 <meta charset="UTF-8">
5 <title>Document</title>
6</head>
7<body>
8 <script>
9 function parseQueryString(){
10 let queryString = location.search.substr(1) || null;
11
12 if(!queryString) return {};
13
14 return queryString.split("&").reduce(function(obj, v) {
15 var pair = v.split("=");
16 obj[pair[0]] = decodeURIComponent(pair[1]);
17 return obj;
18 }, {});
19 }
20
21 function getUserSelectedTime(){
22 return parseQueryString().time || null;
23 }
24
25 console.log(getUserSelectedTime());
26 </script>
27</body>
28</html>