teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

codeの追加(一部省略しています)

2021/07/14 14:16

投稿

ryu-bamboo
ryu-bamboo

スコア9

title CHANGED
File without changes
body CHANGED
@@ -53,4 +53,52 @@
53
53
 
54
54
  ```
55
55
 
56
- resistDataが呼び出されるのは確認済みです。
56
+ resistDataが呼び出されるのは確認済みです。
57
+
58
+ http://localhost:8080/mainformの画面について
59
+ ```html
60
+ <html xmlns:th="http://www.thymeleaf.org">
61
+ <head>
62
+ <meta charset="UTF-8">
63
+ <title>insert here</title>
64
+ <link rel="stylesheet" href="css/mainform.css">
65
+
66
+ <script type="text/javascript" src = "js/dateformatter.js"></script>
67
+
68
+ </head>
69
+ <body class=body>
70
+
71
+ </body>
72
+ </html>
73
+ ```
74
+
75
+ ```js
76
+
77
+ var result = {};
78
+ console.log(window.location.search.substring( 1 ));
79
+ if( 1 < window.location.search.length )
80
+ {
81
+ // 最初の1文字 (?記号) を除いた文字列を取得する
82
+ var query = window.location.search.substring( 1 );
83
+
84
+ console.log(query);
85
+
86
+ // クエリの区切り記号 (&) で文字列を配列に分割する
87
+ var parameters = query.split( '&' );
88
+
89
+ for( var i = 0; i < parameters.length; i++ )
90
+ {
91
+ // パラメータ名とパラメータ値に分割する
92
+ var element = parameters[ i ].split( '=' );
93
+
94
+ var paramName = decodeURIComponent( element[ 0 ] );
95
+ var paramValue = decodeURIComponent( element[ 1 ] );
96
+
97
+ // パラメータ名をキーとして連想配列に追加する
98
+ result[ paramName ] = paramValue;
99
+ }
100
+ }
101
+ ```
102
+ window.location.search.substring( 1 )に値があるかどうかで送信されていないかを区別しました。
103
+
104
+ 情報が不十分でした、すみませんでした。

2

codeの追加(一部省略しています)

2021/07/14 14:16

投稿

ryu-bamboo
ryu-bamboo

スコア9

title CHANGED
File without changes
body CHANGED
@@ -49,6 +49,8 @@
49
49
 
50
50
  calenData += '<span style="position:relative; display:block; z-index:' + zNum-- + ';"><span id="d' + (theMonth + 1) + dateNum + '"></span><a href="javascript:linkGo(\'' + (theMonth + 1) + '\',\'' + dateNum + '\');void(0);" onmouseover="showTtl(\'' + (theMonth + 1) + '\',\'' + dateNum + '\')" onclick="resistData('+dateNum+')" onmouseout="hideTtl(\'' + (theMonth + 1) + '\',\'' + dateNum + '\')" class="linkArea">';
51
51
 
52
+ calenData += '</a><form id="form'+dateNum+'"><input type="hidden" name="month" value='+(theMonth+1)+'><input type="hidden" name="date" value='+dateNum+'></form></span>';
53
+
52
54
  ```
53
55
 
54
56
  resistDataが呼び出されるのは確認済みです。

1

誤字脱字の修正

2021/07/14 11:39

投稿

ryu-bamboo
ryu-bamboo

スコア9

title CHANGED
File without changes
body CHANGED
@@ -49,4 +49,6 @@
49
49
 
50
50
  calenData += '<span style="position:relative; display:block; z-index:' + zNum-- + ';"><span id="d' + (theMonth + 1) + dateNum + '"></span><a href="javascript:linkGo(\'' + (theMonth + 1) + '\',\'' + dateNum + '\');void(0);" onmouseover="showTtl(\'' + (theMonth + 1) + '\',\'' + dateNum + '\')" onclick="resistData('+dateNum+')" onmouseout="hideTtl(\'' + (theMonth + 1) + '\',\'' + dateNum + '\')" class="linkArea">';
51
51
 
52
- ```
52
+ ```
53
+
54
+ resistDataが呼び出されるのは確認済みです。