質問編集履歴
1
コード全文の追加です。
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,8 +3,82 @@
|
|
3
3
|
試しに、pege_jump()を色々なところから呼び出した所、body onloadイベントやbody onloadイベントにて呼ばれるfunctionからpage_jumpを呼び出したら動作しました。でも本来の期待するタイミングで動作してくれません。何かコードにwindow.location.hrefの動作を阻害する要素があるのでしょうか?
|
4
4
|
ブラウザはgoogle chromeです。お分かりになる方、ご教授下さい。よろしくお願い致します。
|
5
5
|
|
6
|
-
```
|
6
|
+
```<!DOCTYPE html>
|
7
|
+
<html>
|
8
|
+
<head>
|
9
|
+
<title>楽 会員登録</title>
|
7
10
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
12
|
+
<meta charset="utf-8">
|
13
|
+
|
14
|
+
<style type="text/css">
|
15
|
+
body {
|
16
|
+
background-color: #fcebd5;
|
17
|
+
background-repeat:no-repeat;
|
18
|
+
background-attachment: fixed;
|
19
|
+
background-position: center top;
|
20
|
+
}
|
21
|
+
#center { text-align:center }
|
22
|
+
.s16 {font-size:16pt}
|
23
|
+
.s14 {font-size:14pt}
|
24
|
+
|
25
|
+
.button {
|
26
|
+
text-align:center;
|
27
|
+
width:150px;
|
28
|
+
font-size:24px;
|
29
|
+
font-weight:bold;
|
30
|
+
text-decoration:none;
|
31
|
+
display:block;
|
32
|
+
text-align:center;
|
33
|
+
padding:8px 0 10px;
|
34
|
+
color:#fff;
|
35
|
+
background-color:#49a9d4;
|
36
|
+
border-radius:5px;
|
37
|
+
box-shadow:2px 2px #1a6ea0;
|
38
|
+
text-shadow:0 -1px #1a6ea0;
|
39
|
+
}
|
40
|
+
</style>
|
41
|
+
|
42
|
+
<!-- ↓JavaScriptの処理を追加 -->
|
43
|
+
<script type="text/javascript">
|
44
|
+
function isRegNum(obj){
|
45
|
+
var str=obj.value; /* 入力値 */
|
46
|
+
if(str.match(/[^0-9]/g)){ /* 数値以外の文字列が含まれていた場合 */
|
47
|
+
alert (str.match(/[^0-9]/g)+'\n\n数値以外が含まれています'); /* アラート表示 */
|
48
|
+
obj.value=""; /* テキストボックスを空にする */
|
49
|
+
return false;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
function checkStr(){
|
53
|
+
var str1 = document.getElementById("password1").value;
|
54
|
+
var str2 = document.getElementById("password2").value;
|
55
|
+
if (str1.match(/[^0-9 a-z a-z A-Z]/g)){
|
56
|
+
alert("英数字以外が含まれています\n(" + str.match(/[^0-9 a-z a-z A-Z]/g) + ")");
|
57
|
+
return false;
|
58
|
+
}
|
59
|
+
if (str2.match(/[^0-9 a-z a-z A-Z]/g)){
|
60
|
+
alert("英数字以外が含まれています\n(" + str.match(/[^0-9 a-z a-z A-Z]/g) + ")");
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
if((str1!="") && (str2!="")){
|
64
|
+
if(str1 != str2){
|
65
|
+
alert("パスワードが一致しません。");
|
66
|
+
document.getElementById("password1").value="";
|
67
|
+
document.getElementById("password2").value="";
|
68
|
+
return false;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
function checkMail(){
|
74
|
+
var str = document.getElementById("userid").value;
|
75
|
+
if(str.match(/^([a-z0-9_.\-])+@([a-z0-9_.\-])+[^.]$/i)){
|
76
|
+
<!-- alert("入力OKです!"); -->
|
77
|
+
}else{
|
78
|
+
alert("メールアドレスの形式が不正です!");
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
8
82
|
function checkkuhaku(){
|
9
83
|
/*
|
10
84
|
~ 略 ~ (コメントアウトして一時的に無効化)
|
@@ -14,15 +88,127 @@
|
|
14
88
|
}
|
15
89
|
|
16
90
|
function page_jump(){
|
91
|
+
alert("hello1");
|
17
92
|
window.location.href='customer_information.php';
|
18
|
-
|
93
|
+
alert("hello2");
|
19
94
|
}
|
20
95
|
|
96
|
+
function nyuuryokuzumi(){
|
97
|
+
var firstname = null;
|
98
|
+
var lastname = null ;
|
99
|
+
var adressno = null;
|
100
|
+
var adress1 = null;
|
101
|
+
var adress2 = null;
|
102
|
+
var adress3 = null;
|
103
|
+
var phone = null;
|
104
|
+
var userid = null;
|
21
105
|
|
106
|
+
str=document.cookie;
|
107
|
+
if(!str){
|
108
|
+
return false;
|
109
|
+
}
|
22
|
-
|
110
|
+
var str2=null;
|
111
|
+
//result = s.substring( start [, end] )
|
112
|
+
result = str.split(";");
|
23
113
|
|
114
|
+
result.forEach( function (str2) {
|
115
|
+
if(str2.indexOf("firstname")>0){
|
116
|
+
firstname =str2.substring( ("'firstname=").length , str2.length-1 );
|
117
|
+
}
|
118
|
+
if(str2.indexOf("lastname")>0){
|
119
|
+
lastname = str2.substring( ("'lastname=").length+1 , str2.length-1 );
|
120
|
+
}
|
121
|
+
if(str2.indexOf("adressno")>0){
|
122
|
+
adressno = str2.substring( ("'adessno=").length+2 , str2.length-1 );
|
123
|
+
}
|
124
|
+
if(str2.indexOf("adress1")>0){
|
125
|
+
adress1 = str2.substring( ("'adress1=").length+1 , str2.length-1 );
|
126
|
+
}
|
127
|
+
if(str2.indexOf("adress2")>0){
|
128
|
+
adress2 = str2.substring( ("'adress2=").length+1 , str2.length-1 );
|
129
|
+
}
|
130
|
+
if(str2.indexOf("adress3")>0){
|
131
|
+
adress3 = str2.substring( ("'adress3=").length+1 , str2.length-1 );
|
132
|
+
}
|
24
|
-
|
133
|
+
if(str2.indexOf("phone")>0){
|
25
|
-
|
134
|
+
phone = str2.substring( ("'phone=").length+1 , str2.length-1 );
|
135
|
+
}
|
136
|
+
if(str2.indexOf("userid")>0){
|
26
|
-
|
137
|
+
userid = str2.substring( ("'userid=").length+1 , str2.length-1 );
|
138
|
+
}
|
139
|
+
});
|
140
|
+
console.log ("firstname:" + firstname);
|
141
|
+
console.log ("lastname:" + lastname);
|
142
|
+
console.log ("adressno:" + adressno);
|
143
|
+
console.log ("adress1:" + adress1);
|
144
|
+
console.log ("adress2:" + adress2);
|
145
|
+
console.log ("adress3:" + adress3);
|
146
|
+
console.log ("phone:" + phone);
|
147
|
+
console.log ("userid:" + userid);
|
27
148
|
|
149
|
+
document.getElementById("firstname").value=firstname;
|
150
|
+
document.getElementById("lastname").value=lastname;
|
151
|
+
document.getElementById("adressno").value=adressno;
|
152
|
+
document.getElementById("adress1").value=adress1;
|
153
|
+
document.getElementById("adress2").value=adress2;
|
154
|
+
document.getElementById("adress3").value=adress3;
|
155
|
+
document.getElementById("phone").value=phone;
|
156
|
+
document.getElementById("userid").value=userid;
|
157
|
+
}
|
158
|
+
|
159
|
+
</script>
|
160
|
+
</head>
|
161
|
+
<body onload="nyuuryokuzumi()">
|
162
|
+
<p id="center">
|
163
|
+
<img src="ラックロゴ.png">
|
164
|
+
</p>
|
165
|
+
|
166
|
+
<form method="post">
|
167
|
+
<div id="center">
|
168
|
+
<p><span class ="s16" >基本情報入力</span></p>
|
169
|
+
</br>
|
170
|
+
|
171
|
+
<p><span class ="s14" >お名前</span></p>
|
172
|
+
<div align = "center"><table>
|
173
|
+
<td><tr><p>姓(漢字)<input type="text" name="firstname" id="firstname"/></tr></td>
|
174
|
+
<td><tr><p>名(漢字)<input type="text" name="lastname" id="lastname"/></tr></td>
|
175
|
+
|
176
|
+
<br/>
|
177
|
+
<p><span class ="s16" >ご住所</span></p>
|
178
|
+
<P><span class ="s14">郵便番号の"-"は入力しないで下さい。</span></P>
|
179
|
+
|
180
|
+
<td><tr><p>郵便番号<input type="text" name="adressno" id="adressno" onchange="isRegNum(this)" /></p></tr><td>
|
181
|
+
<td><tr><p>住所1<input type="text" name="adress1" id="adress1"/></p></tr></td>
|
182
|
+
<td><tr><p>住所2<input type="text" name="adress2" id="adress2" /></tr><td>
|
183
|
+
<td><tr><p>住所3<input type="text" name="adress3" id="adress3" /> </p></tr></td>
|
184
|
+
|
185
|
+
<br/>
|
186
|
+
<span class ="s14" >お電話番号</span> -は入力しないでください
|
187
|
+
|
188
|
+
<td><tr><p>電話番号<input type="text" name="phone" id="phone" onchange="isRegNum(this)" /></p></tr></td>
|
189
|
+
<div id="center"><img src="100x25.png"></div>
|
190
|
+
|
191
|
+
<p><span class ="s14" >ユーザーID(メールアドレス)</span></p>
|
192
|
+
<td><tr><p>ユーザーID<input type="text" id="userid" name = "userid" id="userid" onchange="checkMail()"/></tr></td>
|
193
|
+
|
194
|
+
<div id="center"><img src="100x25.png"></div>
|
195
|
+
<span class ="s14" ><p>パスワード(半角英数字)</p></span>
|
196
|
+
<td><tr><p>パスワード<input type="password" name = "password1" id="password1" onblur="checkStr()"></p></tr><td>
|
197
|
+
</br>
|
198
|
+
<td><tr><p>もう一度 <input type="password" id="password2" onblur="checkStr()"></p></tr></td>
|
199
|
+
</table></div>
|
200
|
+
<div align="center"><img src="100x25.png"></div>
|
201
|
+
<div align="center">
|
202
|
+
<a style="text-decoration:none;" onclick="page_jump()">
|
203
|
+
<button class="button">登録</button></a></div></br>
|
204
|
+
</div>
|
205
|
+
</form>
|
206
|
+
</table>
|
207
|
+
</body>
|
208
|
+
</html>
|
209
|
+
|
28
|
-
```
|
210
|
+
```
|
211
|
+
本来はボタンを押すとfunction nyuuryokuzumi()に飛ぶのですが、検証のため、直接page_jump()に飛ぶようにしています。
|
212
|
+
page_jump()中のalert文はhello1,hello2とも動作確認出来ます。
|
213
|
+
よってwinndow.location.href文が動作していない事がわかります。
|
214
|
+
よろしくお願い致します。
|