質問編集履歴
8
表題の変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
google chrome の「←」ボタンを押してキャラクタを移動したい
|
1
|
+
google chrome の上画面の「←」ボタンを押してキャラクタを移動したい
|
test
CHANGED
File without changes
|
7
表題の変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
google chrome の
|
1
|
+
google chrome の「←」ボタンを押してキャラクタを移動したい
|
test
CHANGED
File without changes
|
6
HTMLの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -640,8 +640,14 @@
|
|
640
640
|
|
641
641
|
|
642
642
|
|
643
|
+
すみません、HTMLも追加したかったのですが、文字数制限でダメだったので、URLを追記します。
|
644
|
+
|
645
|
+
http://up-denshi.candypop.jp/11/rpg8.cgi
|
646
|
+
|
647
|
+
|
648
|
+
|
643
649
|
上記ボタンダウンで、つまづいております。
|
644
650
|
|
645
651
|
ボタンを押した時に、上手くいかず困っています。
|
646
652
|
|
647
|
-
よろしくお願いいたします。
|
653
|
+
何位とぞ、よろしくお願いいたします。
|
5
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -641,3 +641,7 @@
|
|
641
641
|
|
642
642
|
|
643
643
|
上記ボタンダウンで、つまづいております。
|
644
|
+
|
645
|
+
ボタンを押した時に、上手くいかず困っています。
|
646
|
+
|
647
|
+
よろしくお願いいたします。
|
4
コードの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,9 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
|
11
|
+
全コードを書きます。
|
12
|
+
|
13
|
+
```
|
12
14
|
|
13
15
|
function DomToolkit()
|
14
16
|
|
@@ -170,698 +172,472 @@
|
|
170
172
|
|
171
173
|
|
172
174
|
|
175
|
+
function Layer(div)
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
this.div = div;
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
var domtool; // DOM依存のツール
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
var left, top, width, height, cell;
|
192
|
+
|
193
|
+
var mv = 100;
|
194
|
+
|
195
|
+
var pathinfo;
|
196
|
+
|
197
|
+
var reloading = false;
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
var ctrlbreak = false;
|
202
|
+
|
203
|
+
var movingID = null;
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
var CilckFlag1=0;
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
function init(x, y, w, h, c, t)
|
212
|
+
|
213
|
+
{
|
214
|
+
|
215
|
+
domtool = new DomToolkit();
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
left = x;
|
220
|
+
|
221
|
+
top = 0;
|
222
|
+
|
223
|
+
width = w;
|
224
|
+
|
225
|
+
height = 288;
|
226
|
+
|
227
|
+
cell = c;
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
pathinfo = location.search.replace(/&px=\d*|&py=\d*|&ctrl=\d*|&?msg=[^&]*/ig, "");
|
232
|
+
|
233
|
+
setTimeout("reloadFrame()", t * 1000);
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
setInterval("breakControl()", 60);
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
setTimeout("initEventHandler()", 100);
|
242
|
+
|
243
|
+
}
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
function initEventHandler()
|
248
|
+
|
249
|
+
{
|
250
|
+
|
251
|
+
// 入力フレームの生成待ち
|
252
|
+
|
253
|
+
if(!parent.input
|
254
|
+
|
255
|
+
|| !parent.input.document
|
256
|
+
|
257
|
+
|| !parent.input.document.cursor
|
258
|
+
|
259
|
+
|| !parent.input.document.cursor.down) {
|
260
|
+
|
261
|
+
setTimeout("initEventHandler()", 100);
|
262
|
+
|
263
|
+
return;
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
if(document.all) {
|
270
|
+
|
271
|
+
// IE
|
272
|
+
|
273
|
+
document.onkeypress = handleKeypress;
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
with(parent.input) {
|
278
|
+
|
279
|
+
document.cursor.left.onmousedown = handleMouseDown;
|
280
|
+
|
281
|
+
document.cursor.right.onmousedown = handleMouseDown;
|
282
|
+
|
283
|
+
document.cursor.up.onmousedown = handleMouseDown;
|
284
|
+
|
285
|
+
document.cursor.down.onmousedown = handleMouseDown;
|
286
|
+
|
287
|
+
document.onmouseup = handleMouseUp;
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
else if(document.getElementById) {
|
294
|
+
|
295
|
+
// Mozilla
|
296
|
+
|
297
|
+
document.addEventListener("keypress", handleKeypress, true);
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
with(parent.input) {
|
302
|
+
|
303
|
+
document.cursor.left.addEventListener("mousedown", handleMouseDown, true);
|
304
|
+
|
305
|
+
document.cursor.right.addEventListener("mousedown", handleMouseDown, true);
|
306
|
+
|
307
|
+
document.cursor.up.addEventListener("mousedown", handleMouseDown, true);
|
308
|
+
|
309
|
+
document.cursor.down.addEventListener("mousedown", handleMouseDown, true);
|
310
|
+
|
311
|
+
document.addEventListener("mouseup", handleMouseUp, false);
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
else {
|
318
|
+
|
319
|
+
// NN4
|
320
|
+
|
321
|
+
document.onkeypress = handleKeypress;
|
322
|
+
|
323
|
+
document.captureEvents(Event.KEYPRESS);
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
with(parent.input) {
|
328
|
+
|
329
|
+
document.cursor.left.onmousedown = handleMouseDown;
|
330
|
+
|
331
|
+
document.cursor.right.onmousedown = handleMouseDown;
|
332
|
+
|
333
|
+
document.cursor.up.onmousedown = handleMouseDown;
|
334
|
+
|
335
|
+
document.cursor.down.onmousedown = handleMouseDown;
|
336
|
+
|
337
|
+
document.onmouseup = handleMouseUp;
|
338
|
+
|
339
|
+
document.captureEvents(Event.MOUSEUP);
|
340
|
+
|
341
|
+
}
|
342
|
+
|
343
|
+
}
|
344
|
+
|
345
|
+
}
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
function handleKeypress(event)
|
350
|
+
|
351
|
+
{
|
352
|
+
|
353
|
+
if(ctrlbreak) {
|
354
|
+
|
355
|
+
return false;
|
356
|
+
|
357
|
+
}
|
358
|
+
|
359
|
+
ctrlbreak = true;
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
if(document.all) {
|
364
|
+
|
365
|
+
key = window.event.keyCode;
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
else {
|
370
|
+
|
371
|
+
key = event.which;
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
moveChar(String.fromCharCode(key));
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
function breakControl()
|
382
|
+
|
383
|
+
{
|
384
|
+
|
385
|
+
ctrlbreak = false;
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
function handleMouseDown(event) {
|
394
|
+
|
395
|
+
if(movingID != null) {
|
396
|
+
|
397
|
+
clearInterval(movingID);
|
398
|
+
|
399
|
+
movingID = null;
|
400
|
+
|
401
|
+
}
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
if(document.all) {
|
406
|
+
|
407
|
+
button = parent.input.event.srcElement.name;
|
408
|
+
|
409
|
+
}
|
410
|
+
|
411
|
+
else {
|
412
|
+
|
413
|
+
button = event.target.name;
|
414
|
+
|
415
|
+
}
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
switch(button) {
|
420
|
+
|
421
|
+
case 'left':
|
422
|
+
|
423
|
+
keych = '4'; break;
|
424
|
+
|
425
|
+
case 'right':
|
426
|
+
|
427
|
+
keych = '6'; break;
|
428
|
+
|
429
|
+
case 'up':
|
430
|
+
|
431
|
+
keych = '8'; break;
|
432
|
+
|
433
|
+
case 'down':
|
434
|
+
|
435
|
+
keych = '2'; break;
|
436
|
+
|
437
|
+
default:
|
438
|
+
|
439
|
+
keych = '5';
|
440
|
+
|
441
|
+
}
|
442
|
+
|
443
|
+
movingID = setInterval("moveChar('" + keych + "')", 60);
|
444
|
+
|
445
|
+
}
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
function handleMouseUp(event) {
|
450
|
+
|
451
|
+
if(movingID != null) {
|
452
|
+
|
453
|
+
clearInterval(movingID);
|
454
|
+
|
455
|
+
movingID = null;
|
456
|
+
|
457
|
+
}
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
function reloadFrame()
|
464
|
+
|
465
|
+
{
|
466
|
+
|
467
|
+
if(reloading) {
|
468
|
+
|
469
|
+
return;
|
470
|
+
|
471
|
+
}
|
472
|
+
|
473
|
+
reloading = true;
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
layer = domtool.getLayer("char0");
|
478
|
+
|
479
|
+
x = layer.getX();
|
480
|
+
|
481
|
+
y = layer.getY();
|
482
|
+
|
483
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y;
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
function moveChar(key)
|
490
|
+
|
491
|
+
{
|
492
|
+
|
493
|
+
var key2 = key;
|
494
|
+
|
495
|
+
if(reloading) {
|
496
|
+
|
497
|
+
return;
|
498
|
+
|
499
|
+
}
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
layer = domtool.getLayer("char0");
|
504
|
+
|
505
|
+
x = layer.getX();
|
506
|
+
|
507
|
+
y = layer.getY();
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
dx = 0;
|
512
|
+
|
513
|
+
dy = 0;
|
514
|
+
|
515
|
+
switch(key2) {
|
516
|
+
|
517
|
+
case '4': // left
|
518
|
+
|
519
|
+
dx = -mv;
|
520
|
+
|
521
|
+
if(x + dx < left) {
|
522
|
+
|
523
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=4";
|
524
|
+
|
525
|
+
reloading = true;
|
526
|
+
|
527
|
+
}
|
528
|
+
|
529
|
+
break;
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
case '6': // right
|
534
|
+
|
535
|
+
dx = mv;
|
536
|
+
|
537
|
+
if(x + dx + cell > left + width) {
|
538
|
+
|
539
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=6";
|
540
|
+
|
541
|
+
reloading = true;
|
542
|
+
|
543
|
+
}
|
544
|
+
|
545
|
+
break;
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
case '8': // up
|
550
|
+
|
551
|
+
dy = -mv;
|
552
|
+
|
553
|
+
// if(y + dy < top) {
|
554
|
+
|
555
|
+
if(y + dy < 0) {
|
556
|
+
|
557
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=8";
|
558
|
+
|
559
|
+
reloading = true;
|
560
|
+
|
561
|
+
}
|
562
|
+
|
563
|
+
break;
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
case '2': // down
|
568
|
+
|
569
|
+
dy = mv;
|
570
|
+
|
571
|
+
// if(y + dy + cell > top + height) {
|
572
|
+
|
573
|
+
if(y + dy + cell > 288 ) {
|
574
|
+
|
575
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=2";
|
576
|
+
|
577
|
+
reloading = true;
|
578
|
+
|
579
|
+
}
|
580
|
+
|
581
|
+
break;
|
582
|
+
|
583
|
+
}
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
if(!reloading) {
|
588
|
+
|
589
|
+
layer.moveBy(dx, dy);
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
layer2 = domtool.getLayer("balloon0");
|
594
|
+
|
595
|
+
layer3 = domtool.getLayer("text0");
|
596
|
+
|
597
|
+
|
598
|
+
|
599
|
+
if(layer2.div && layer3.div) {
|
600
|
+
|
601
|
+
layer2.moveBy(dx, dy);
|
602
|
+
|
603
|
+
layer3.moveBy(dx, dy);
|
604
|
+
|
605
|
+
}
|
606
|
+
|
607
|
+
}
|
608
|
+
|
609
|
+
}
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
function getCharLeft()
|
614
|
+
|
615
|
+
{
|
616
|
+
|
617
|
+
return domtool.getLayer("char0").getX();
|
618
|
+
|
619
|
+
}
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
function getCharTop()
|
624
|
+
|
625
|
+
{
|
626
|
+
|
627
|
+
return domtool.getLayer("char0").getY();
|
628
|
+
|
629
|
+
}
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
コード
|
638
|
+
|
173
639
|
```
|
174
640
|
|
175
|
-
何卒よろしくお願いします。
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
全コードを書きます。
|
180
|
-
|
181
|
-
```
|
182
|
-
|
183
|
-
function DomToolkit()
|
184
|
-
|
185
|
-
{
|
186
|
-
|
187
|
-
if(document.all) {
|
188
|
-
|
189
|
-
// IE
|
190
|
-
|
191
|
-
Layer.prototype.setVisibility = function(f) {
|
192
|
-
|
193
|
-
this.div.style.visibility = (f ? "visible" : "hidden");
|
194
|
-
|
195
|
-
};
|
196
|
-
|
197
|
-
Layer.prototype.getX = function() {
|
198
|
-
|
199
|
-
return this.div.style.pixelLeft;
|
200
|
-
|
201
|
-
};
|
202
|
-
|
203
|
-
Layer.prototype.getY = function() {
|
204
|
-
|
205
|
-
return this.div.style.pixelTop;
|
206
|
-
|
207
|
-
};
|
208
|
-
|
209
|
-
Layer.prototype.moveTo = function(x, y) {
|
210
|
-
|
211
|
-
this.div.style.pixelLeft = x;
|
212
|
-
|
213
|
-
this.div.style.pixelTop = y;
|
214
|
-
|
215
|
-
};
|
216
|
-
|
217
|
-
Layer.prototype.moveBy = function(dx, dy) {
|
218
|
-
|
219
|
-
this.div.style.pixelLeft += dx;
|
220
|
-
|
221
|
-
this.div.style.pixelTop += dy;
|
222
|
-
|
223
|
-
};
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
this.getLayer = function(id) {
|
228
|
-
|
229
|
-
return new Layer(document.all[id]);
|
230
|
-
|
231
|
-
};
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
else if(document.getElementById) {
|
236
|
-
|
237
|
-
// Mozilla chrome
|
238
|
-
|
239
|
-
Layer.prototype.setVisibility = function(f) {
|
240
|
-
|
241
|
-
this.div.style.visibility = (f ? "visible" : "hidden");
|
242
|
-
|
243
|
-
};
|
244
|
-
|
245
|
-
Layer.prototype.getX = function() {
|
246
|
-
|
247
|
-
return parseInt(this.div.style.left);
|
248
|
-
|
249
|
-
};
|
250
|
-
|
251
|
-
Layer.prototype.getY = function() {
|
252
|
-
|
253
|
-
return parseInt(this.div.style.top);
|
254
|
-
|
255
|
-
};
|
256
|
-
|
257
|
-
Layer.prototype.moveTo = function(x, y) {
|
258
|
-
|
259
|
-
this.div.style.left = x;
|
260
|
-
|
261
|
-
this.div.style.top = y;
|
262
|
-
|
263
|
-
};
|
264
|
-
|
265
|
-
Layer.prototype.moveBy = function(dx, dy) {
|
266
|
-
|
267
|
-
this.div.style.left = parseInt(this.div.style.left) + dx;
|
268
|
-
|
269
|
-
this.div.style.top = parseInt(this.div.style.top) + dy;
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
};
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
this.getLayer = function(id) {
|
278
|
-
|
279
|
-
return new Layer(document.getElementById(id));
|
280
|
-
|
281
|
-
};
|
282
|
-
|
283
|
-
}
|
284
|
-
|
285
|
-
else {
|
286
|
-
|
287
|
-
// NN4
|
288
|
-
|
289
|
-
Layer.prototype.setVisibility = function(f) {
|
290
|
-
|
291
|
-
this.div.visibility = (f ? "show" : "hide");
|
292
|
-
|
293
|
-
};
|
294
|
-
|
295
|
-
Layer.prototype.getX = function() {
|
296
|
-
|
297
|
-
return this.div.left;
|
298
|
-
|
299
|
-
};
|
300
|
-
|
301
|
-
Layer.prototype.getY = function() {
|
302
|
-
|
303
|
-
return this.div.top;
|
304
|
-
|
305
|
-
};
|
306
|
-
|
307
|
-
Layer.prototype.moveTo = function(x, y) {
|
308
|
-
|
309
|
-
this.div.moveTo(x, y);
|
310
|
-
|
311
|
-
};
|
312
|
-
|
313
|
-
Layer.prototype.moveBy = function(dx, dy) {
|
314
|
-
|
315
|
-
this.div.moveBy(dx, dy);
|
316
|
-
|
317
|
-
};
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
this.getLayer = function(id) {
|
322
|
-
|
323
|
-
var i = arguments.length - 1;
|
324
|
-
|
325
|
-
var layer = document.layers[arguments[i--]];
|
326
|
-
|
327
|
-
while(i >= 0 && layer) {
|
328
|
-
|
329
|
-
layer = layer.layers[arguments[i--]];
|
330
|
-
|
331
|
-
}
|
332
|
-
|
333
|
-
return new Layer(layer);
|
334
|
-
|
335
|
-
};
|
336
|
-
|
337
|
-
}
|
338
|
-
|
339
|
-
}
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
function Layer(div)
|
344
|
-
|
345
|
-
{
|
346
|
-
|
347
|
-
this.div = div;
|
348
|
-
|
349
|
-
}
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
var domtool; // DOM依存のツール
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
var left, top, width, height, cell;
|
360
|
-
|
361
|
-
var mv = 100;
|
362
|
-
|
363
|
-
var pathinfo;
|
364
|
-
|
365
|
-
var reloading = false;
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
var ctrlbreak = false;
|
370
|
-
|
371
|
-
var movingID = null;
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
var CilckFlag1=0;
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
function init(x, y, w, h, c, t)
|
380
|
-
|
381
|
-
{
|
382
|
-
|
383
|
-
domtool = new DomToolkit();
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
left = x;
|
388
|
-
|
389
|
-
top = 0;
|
390
|
-
|
391
|
-
width = w;
|
392
|
-
|
393
|
-
height = 288;
|
394
|
-
|
395
|
-
cell = c;
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
pathinfo = location.search.replace(/&px=\d*|&py=\d*|&ctrl=\d*|&?msg=[^&]*/ig, "");
|
400
|
-
|
401
|
-
setTimeout("reloadFrame()", t * 1000);
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
setInterval("breakControl()", 60);
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
setTimeout("initEventHandler()", 100);
|
410
|
-
|
411
|
-
}
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
function initEventHandler()
|
416
|
-
|
417
|
-
{
|
418
|
-
|
419
|
-
// 入力フレームの生成待ち
|
420
|
-
|
421
|
-
if(!parent.input
|
422
|
-
|
423
|
-
|| !parent.input.document
|
424
|
-
|
425
|
-
|| !parent.input.document.cursor
|
426
|
-
|
427
|
-
|| !parent.input.document.cursor.down) {
|
428
|
-
|
429
|
-
setTimeout("initEventHandler()", 100);
|
430
|
-
|
431
|
-
return;
|
432
|
-
|
433
|
-
}
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
if(document.all) {
|
438
|
-
|
439
|
-
// IE
|
440
|
-
|
441
|
-
document.onkeypress = handleKeypress;
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
with(parent.input) {
|
446
|
-
|
447
|
-
document.cursor.left.onmousedown = handleMouseDown;
|
448
|
-
|
449
|
-
document.cursor.right.onmousedown = handleMouseDown;
|
450
|
-
|
451
|
-
document.cursor.up.onmousedown = handleMouseDown;
|
452
|
-
|
453
|
-
document.cursor.down.onmousedown = handleMouseDown;
|
454
|
-
|
455
|
-
document.onmouseup = handleMouseUp;
|
456
|
-
|
457
|
-
}
|
458
|
-
|
459
|
-
}
|
460
|
-
|
461
|
-
else if(document.getElementById) {
|
462
|
-
|
463
|
-
// Mozilla
|
464
|
-
|
465
|
-
document.addEventListener("keypress", handleKeypress, true);
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
with(parent.input) {
|
470
|
-
|
471
|
-
document.cursor.left.addEventListener("mousedown", handleMouseDown, true);
|
472
|
-
|
473
|
-
document.cursor.right.addEventListener("mousedown", handleMouseDown, true);
|
474
|
-
|
475
|
-
document.cursor.up.addEventListener("mousedown", handleMouseDown, true);
|
476
|
-
|
477
|
-
document.cursor.down.addEventListener("mousedown", handleMouseDown, true);
|
478
|
-
|
479
|
-
document.addEventListener("mouseup", handleMouseUp, false);
|
480
|
-
|
481
|
-
}
|
482
|
-
|
483
|
-
}
|
484
|
-
|
485
|
-
else {
|
486
|
-
|
487
|
-
// NN4
|
488
|
-
|
489
|
-
document.onkeypress = handleKeypress;
|
490
|
-
|
491
|
-
document.captureEvents(Event.KEYPRESS);
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
with(parent.input) {
|
496
|
-
|
497
|
-
document.cursor.left.onmousedown = handleMouseDown;
|
498
|
-
|
499
|
-
document.cursor.right.onmousedown = handleMouseDown;
|
500
|
-
|
501
|
-
document.cursor.up.onmousedown = handleMouseDown;
|
502
|
-
|
503
|
-
document.cursor.down.onmousedown = handleMouseDown;
|
504
|
-
|
505
|
-
document.onmouseup = handleMouseUp;
|
506
|
-
|
507
|
-
document.captureEvents(Event.MOUSEUP);
|
508
|
-
|
509
|
-
}
|
510
|
-
|
511
|
-
}
|
512
|
-
|
513
|
-
}
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
function handleKeypress(event)
|
518
|
-
|
519
|
-
{
|
520
|
-
|
521
|
-
if(ctrlbreak) {
|
522
|
-
|
523
|
-
return false;
|
524
|
-
|
525
|
-
}
|
526
|
-
|
527
|
-
ctrlbreak = true;
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
if(document.all) {
|
532
|
-
|
533
|
-
key = window.event.keyCode;
|
534
|
-
|
535
|
-
}
|
536
|
-
|
537
|
-
else {
|
538
|
-
|
539
|
-
key = event.which;
|
540
|
-
|
541
|
-
}
|
542
|
-
|
543
|
-
moveChar(String.fromCharCode(key));
|
544
|
-
|
545
|
-
}
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
function breakControl()
|
550
|
-
|
551
|
-
{
|
552
|
-
|
553
|
-
ctrlbreak = false;
|
554
|
-
|
555
|
-
}
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
function handleMouseDown(event) {
|
562
|
-
|
563
|
-
if(movingID != null) {
|
564
|
-
|
565
|
-
clearInterval(movingID);
|
566
|
-
|
567
|
-
movingID = null;
|
568
|
-
|
569
|
-
}
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
if(document.all) {
|
574
|
-
|
575
|
-
button = parent.input.event.srcElement.name;
|
576
|
-
|
577
|
-
}
|
578
|
-
|
579
|
-
else {
|
580
|
-
|
581
|
-
button = event.target.name;
|
582
|
-
|
583
|
-
}
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
switch(button) {
|
588
|
-
|
589
|
-
case 'left':
|
590
|
-
|
591
|
-
keych = '4'; break;
|
592
|
-
|
593
|
-
case 'right':
|
594
|
-
|
595
|
-
keych = '6'; break;
|
596
|
-
|
597
|
-
case 'up':
|
598
|
-
|
599
|
-
keych = '8'; break;
|
600
|
-
|
601
|
-
case 'down':
|
602
|
-
|
603
|
-
keych = '2'; break;
|
604
|
-
|
605
|
-
default:
|
606
|
-
|
607
|
-
keych = '5';
|
608
|
-
|
609
|
-
}
|
610
|
-
|
611
|
-
movingID = setInterval("moveChar('" + keych + "')", 60);
|
612
|
-
|
613
|
-
}
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
function handleMouseUp(event) {
|
618
|
-
|
619
|
-
if(movingID != null) {
|
620
|
-
|
621
|
-
clearInterval(movingID);
|
622
|
-
|
623
|
-
movingID = null;
|
624
|
-
|
625
|
-
}
|
626
|
-
|
627
|
-
}
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
function reloadFrame()
|
632
|
-
|
633
|
-
{
|
634
|
-
|
635
|
-
if(reloading) {
|
636
|
-
|
637
|
-
return;
|
638
|
-
|
639
|
-
}
|
640
|
-
|
641
|
-
reloading = true;
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
layer = domtool.getLayer("char0");
|
646
|
-
|
647
|
-
x = layer.getX();
|
648
|
-
|
649
|
-
y = layer.getY();
|
650
|
-
|
651
|
-
location.search = pathinfo + "&px=" + x + "&py=" + y;
|
652
|
-
|
653
|
-
}
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
function moveChar(key)
|
658
|
-
|
659
|
-
{
|
660
|
-
|
661
|
-
var key2 = key;
|
662
|
-
|
663
|
-
if(reloading) {
|
664
|
-
|
665
|
-
return;
|
666
|
-
|
667
|
-
}
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
layer = domtool.getLayer("char0");
|
672
|
-
|
673
|
-
x = layer.getX();
|
674
|
-
|
675
|
-
y = layer.getY();
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
dx = 0;
|
680
|
-
|
681
|
-
dy = 0;
|
682
|
-
|
683
|
-
switch(key2) {
|
684
|
-
|
685
|
-
case '4': // left
|
686
|
-
|
687
|
-
dx = -mv;
|
688
|
-
|
689
|
-
if(x + dx < left) {
|
690
|
-
|
691
|
-
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=4";
|
692
|
-
|
693
|
-
reloading = true;
|
694
|
-
|
695
|
-
}
|
696
|
-
|
697
|
-
break;
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
case '6': // right
|
702
|
-
|
703
|
-
dx = mv;
|
704
|
-
|
705
|
-
if(x + dx + cell > left + width) {
|
706
|
-
|
707
|
-
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=6";
|
708
|
-
|
709
|
-
reloading = true;
|
710
|
-
|
711
|
-
}
|
712
|
-
|
713
|
-
break;
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
case '8': // up
|
718
|
-
|
719
|
-
dy = -mv;
|
720
|
-
|
721
|
-
// if(y + dy < top) {
|
722
|
-
|
723
|
-
if(y + dy < 0) {
|
724
|
-
|
725
|
-
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=8";
|
726
|
-
|
727
|
-
reloading = true;
|
728
|
-
|
729
|
-
}
|
730
|
-
|
731
|
-
break;
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
case '2': // down
|
736
|
-
|
737
|
-
dy = mv;
|
738
|
-
|
739
|
-
// if(y + dy + cell > top + height) {
|
740
|
-
|
741
|
-
if(y + dy + cell > 288 ) {
|
742
|
-
|
743
|
-
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=2";
|
744
|
-
|
745
|
-
reloading = true;
|
746
|
-
|
747
|
-
}
|
748
|
-
|
749
|
-
break;
|
750
|
-
|
751
|
-
}
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
if(!reloading) {
|
756
|
-
|
757
|
-
layer.moveBy(dx, dy);
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
layer2 = domtool.getLayer("balloon0");
|
762
|
-
|
763
|
-
layer3 = domtool.getLayer("text0");
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
if(layer2.div && layer3.div) {
|
768
|
-
|
769
|
-
layer2.moveBy(dx, dy);
|
770
|
-
|
771
|
-
layer3.moveBy(dx, dy);
|
772
|
-
|
773
|
-
}
|
774
|
-
|
775
|
-
}
|
776
|
-
|
777
|
-
}
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
function getCharLeft()
|
782
|
-
|
783
|
-
{
|
784
|
-
|
785
|
-
return domtool.getLayer("char0").getX();
|
786
|
-
|
787
|
-
}
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
function getCharTop()
|
792
|
-
|
793
|
-
{
|
794
|
-
|
795
|
-
return domtool.getLayer("char0").getY();
|
796
|
-
|
797
|
-
}
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
function OnButtonClick1() {
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
if(CilckFlag1==1){
|
808
|
-
|
809
|
-
target = document.getElementById("output1");
|
810
|
-
|
811
|
-
target.innerHTML = "クリックされました!!";
|
812
|
-
|
813
|
-
CilckFlag1=0;
|
814
|
-
|
815
|
-
}else if(CilckFlag1==0){
|
816
|
-
|
817
|
-
target = document.getElementById("output1");
|
818
|
-
|
819
|
-
target.innerHTML = "クリックさてません。。。";
|
820
|
-
|
821
|
-
CilckFlag1=1;
|
822
|
-
|
823
|
-
}
|
824
|
-
|
825
|
-
}
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
コード
|
830
|
-
|
831
|
-
```
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
今、ボタンをクリックしても状態が変わらず、つまづいています。
|
836
|
-
|
837
|
-
```ここに言語を入力
|
838
|
-
|
839
|
-
else if(document.getElementById) {
|
840
|
-
|
841
|
-
// Mozilla
|
842
|
-
|
843
|
-
document.addEventListener("keypress", handleKeypress, true);
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
with(parent.input) {
|
848
|
-
|
849
|
-
document.cursor.left.addEventListener("mousedown", handleMouseDown, true);
|
850
|
-
|
851
|
-
document.cursor.right.addEventListener("mousedown", handleMouseDown, true);
|
852
|
-
|
853
|
-
document.cursor.up.addEventListener("mousedown", handleMouseDown, true);
|
854
|
-
|
855
|
-
document.cursor.down.addEventListener("mousedown", handleMouseDown, true);
|
856
|
-
|
857
|
-
document.addEventListener("mouseup", handleMouseUp, false);
|
858
|
-
|
859
|
-
}
|
860
|
-
|
861
|
-
}
|
862
|
-
|
863
|
-
```
|
864
|
-
|
865
641
|
|
866
642
|
|
867
643
|
上記ボタンダウンで、つまづいております。
|
3
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -178,7 +178,9 @@
|
|
178
178
|
|
179
179
|
全コードを書きます。
|
180
180
|
|
181
|
+
```
|
182
|
+
|
181
|
-
|
183
|
+
function DomToolkit()
|
182
184
|
|
183
185
|
{
|
184
186
|
|
2
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -831,3 +831,35 @@
|
|
831
831
|
|
832
832
|
|
833
833
|
今、ボタンをクリックしても状態が変わらず、つまづいています。
|
834
|
+
|
835
|
+
```ここに言語を入力
|
836
|
+
|
837
|
+
else if(document.getElementById) {
|
838
|
+
|
839
|
+
// Mozilla
|
840
|
+
|
841
|
+
document.addEventListener("keypress", handleKeypress, true);
|
842
|
+
|
843
|
+
|
844
|
+
|
845
|
+
with(parent.input) {
|
846
|
+
|
847
|
+
document.cursor.left.addEventListener("mousedown", handleMouseDown, true);
|
848
|
+
|
849
|
+
document.cursor.right.addEventListener("mousedown", handleMouseDown, true);
|
850
|
+
|
851
|
+
document.cursor.up.addEventListener("mousedown", handleMouseDown, true);
|
852
|
+
|
853
|
+
document.cursor.down.addEventListener("mousedown", handleMouseDown, true);
|
854
|
+
|
855
|
+
document.addEventListener("mouseup", handleMouseUp, false);
|
856
|
+
|
857
|
+
}
|
858
|
+
|
859
|
+
}
|
860
|
+
|
861
|
+
```
|
862
|
+
|
863
|
+
|
864
|
+
|
865
|
+
上記ボタンダウンで、つまづいております。
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -173,3 +173,661 @@
|
|
173
173
|
```
|
174
174
|
|
175
175
|
何卒よろしくお願いします。
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
全コードを書きます。
|
180
|
+
|
181
|
+
```function DomToolkit()
|
182
|
+
|
183
|
+
{
|
184
|
+
|
185
|
+
if(document.all) {
|
186
|
+
|
187
|
+
// IE
|
188
|
+
|
189
|
+
Layer.prototype.setVisibility = function(f) {
|
190
|
+
|
191
|
+
this.div.style.visibility = (f ? "visible" : "hidden");
|
192
|
+
|
193
|
+
};
|
194
|
+
|
195
|
+
Layer.prototype.getX = function() {
|
196
|
+
|
197
|
+
return this.div.style.pixelLeft;
|
198
|
+
|
199
|
+
};
|
200
|
+
|
201
|
+
Layer.prototype.getY = function() {
|
202
|
+
|
203
|
+
return this.div.style.pixelTop;
|
204
|
+
|
205
|
+
};
|
206
|
+
|
207
|
+
Layer.prototype.moveTo = function(x, y) {
|
208
|
+
|
209
|
+
this.div.style.pixelLeft = x;
|
210
|
+
|
211
|
+
this.div.style.pixelTop = y;
|
212
|
+
|
213
|
+
};
|
214
|
+
|
215
|
+
Layer.prototype.moveBy = function(dx, dy) {
|
216
|
+
|
217
|
+
this.div.style.pixelLeft += dx;
|
218
|
+
|
219
|
+
this.div.style.pixelTop += dy;
|
220
|
+
|
221
|
+
};
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
this.getLayer = function(id) {
|
226
|
+
|
227
|
+
return new Layer(document.all[id]);
|
228
|
+
|
229
|
+
};
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
else if(document.getElementById) {
|
234
|
+
|
235
|
+
// Mozilla chrome
|
236
|
+
|
237
|
+
Layer.prototype.setVisibility = function(f) {
|
238
|
+
|
239
|
+
this.div.style.visibility = (f ? "visible" : "hidden");
|
240
|
+
|
241
|
+
};
|
242
|
+
|
243
|
+
Layer.prototype.getX = function() {
|
244
|
+
|
245
|
+
return parseInt(this.div.style.left);
|
246
|
+
|
247
|
+
};
|
248
|
+
|
249
|
+
Layer.prototype.getY = function() {
|
250
|
+
|
251
|
+
return parseInt(this.div.style.top);
|
252
|
+
|
253
|
+
};
|
254
|
+
|
255
|
+
Layer.prototype.moveTo = function(x, y) {
|
256
|
+
|
257
|
+
this.div.style.left = x;
|
258
|
+
|
259
|
+
this.div.style.top = y;
|
260
|
+
|
261
|
+
};
|
262
|
+
|
263
|
+
Layer.prototype.moveBy = function(dx, dy) {
|
264
|
+
|
265
|
+
this.div.style.left = parseInt(this.div.style.left) + dx;
|
266
|
+
|
267
|
+
this.div.style.top = parseInt(this.div.style.top) + dy;
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
};
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
this.getLayer = function(id) {
|
276
|
+
|
277
|
+
return new Layer(document.getElementById(id));
|
278
|
+
|
279
|
+
};
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
else {
|
284
|
+
|
285
|
+
// NN4
|
286
|
+
|
287
|
+
Layer.prototype.setVisibility = function(f) {
|
288
|
+
|
289
|
+
this.div.visibility = (f ? "show" : "hide");
|
290
|
+
|
291
|
+
};
|
292
|
+
|
293
|
+
Layer.prototype.getX = function() {
|
294
|
+
|
295
|
+
return this.div.left;
|
296
|
+
|
297
|
+
};
|
298
|
+
|
299
|
+
Layer.prototype.getY = function() {
|
300
|
+
|
301
|
+
return this.div.top;
|
302
|
+
|
303
|
+
};
|
304
|
+
|
305
|
+
Layer.prototype.moveTo = function(x, y) {
|
306
|
+
|
307
|
+
this.div.moveTo(x, y);
|
308
|
+
|
309
|
+
};
|
310
|
+
|
311
|
+
Layer.prototype.moveBy = function(dx, dy) {
|
312
|
+
|
313
|
+
this.div.moveBy(dx, dy);
|
314
|
+
|
315
|
+
};
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
this.getLayer = function(id) {
|
320
|
+
|
321
|
+
var i = arguments.length - 1;
|
322
|
+
|
323
|
+
var layer = document.layers[arguments[i--]];
|
324
|
+
|
325
|
+
while(i >= 0 && layer) {
|
326
|
+
|
327
|
+
layer = layer.layers[arguments[i--]];
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
return new Layer(layer);
|
332
|
+
|
333
|
+
};
|
334
|
+
|
335
|
+
}
|
336
|
+
|
337
|
+
}
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
function Layer(div)
|
342
|
+
|
343
|
+
{
|
344
|
+
|
345
|
+
this.div = div;
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
var domtool; // DOM依存のツール
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
var left, top, width, height, cell;
|
358
|
+
|
359
|
+
var mv = 100;
|
360
|
+
|
361
|
+
var pathinfo;
|
362
|
+
|
363
|
+
var reloading = false;
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
var ctrlbreak = false;
|
368
|
+
|
369
|
+
var movingID = null;
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
var CilckFlag1=0;
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
function init(x, y, w, h, c, t)
|
378
|
+
|
379
|
+
{
|
380
|
+
|
381
|
+
domtool = new DomToolkit();
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
left = x;
|
386
|
+
|
387
|
+
top = 0;
|
388
|
+
|
389
|
+
width = w;
|
390
|
+
|
391
|
+
height = 288;
|
392
|
+
|
393
|
+
cell = c;
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
pathinfo = location.search.replace(/&px=\d*|&py=\d*|&ctrl=\d*|&?msg=[^&]*/ig, "");
|
398
|
+
|
399
|
+
setTimeout("reloadFrame()", t * 1000);
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
setInterval("breakControl()", 60);
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
setTimeout("initEventHandler()", 100);
|
408
|
+
|
409
|
+
}
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
function initEventHandler()
|
414
|
+
|
415
|
+
{
|
416
|
+
|
417
|
+
// 入力フレームの生成待ち
|
418
|
+
|
419
|
+
if(!parent.input
|
420
|
+
|
421
|
+
|| !parent.input.document
|
422
|
+
|
423
|
+
|| !parent.input.document.cursor
|
424
|
+
|
425
|
+
|| !parent.input.document.cursor.down) {
|
426
|
+
|
427
|
+
setTimeout("initEventHandler()", 100);
|
428
|
+
|
429
|
+
return;
|
430
|
+
|
431
|
+
}
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
if(document.all) {
|
436
|
+
|
437
|
+
// IE
|
438
|
+
|
439
|
+
document.onkeypress = handleKeypress;
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
with(parent.input) {
|
444
|
+
|
445
|
+
document.cursor.left.onmousedown = handleMouseDown;
|
446
|
+
|
447
|
+
document.cursor.right.onmousedown = handleMouseDown;
|
448
|
+
|
449
|
+
document.cursor.up.onmousedown = handleMouseDown;
|
450
|
+
|
451
|
+
document.cursor.down.onmousedown = handleMouseDown;
|
452
|
+
|
453
|
+
document.onmouseup = handleMouseUp;
|
454
|
+
|
455
|
+
}
|
456
|
+
|
457
|
+
}
|
458
|
+
|
459
|
+
else if(document.getElementById) {
|
460
|
+
|
461
|
+
// Mozilla
|
462
|
+
|
463
|
+
document.addEventListener("keypress", handleKeypress, true);
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
with(parent.input) {
|
468
|
+
|
469
|
+
document.cursor.left.addEventListener("mousedown", handleMouseDown, true);
|
470
|
+
|
471
|
+
document.cursor.right.addEventListener("mousedown", handleMouseDown, true);
|
472
|
+
|
473
|
+
document.cursor.up.addEventListener("mousedown", handleMouseDown, true);
|
474
|
+
|
475
|
+
document.cursor.down.addEventListener("mousedown", handleMouseDown, true);
|
476
|
+
|
477
|
+
document.addEventListener("mouseup", handleMouseUp, false);
|
478
|
+
|
479
|
+
}
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
else {
|
484
|
+
|
485
|
+
// NN4
|
486
|
+
|
487
|
+
document.onkeypress = handleKeypress;
|
488
|
+
|
489
|
+
document.captureEvents(Event.KEYPRESS);
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
with(parent.input) {
|
494
|
+
|
495
|
+
document.cursor.left.onmousedown = handleMouseDown;
|
496
|
+
|
497
|
+
document.cursor.right.onmousedown = handleMouseDown;
|
498
|
+
|
499
|
+
document.cursor.up.onmousedown = handleMouseDown;
|
500
|
+
|
501
|
+
document.cursor.down.onmousedown = handleMouseDown;
|
502
|
+
|
503
|
+
document.onmouseup = handleMouseUp;
|
504
|
+
|
505
|
+
document.captureEvents(Event.MOUSEUP);
|
506
|
+
|
507
|
+
}
|
508
|
+
|
509
|
+
}
|
510
|
+
|
511
|
+
}
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
function handleKeypress(event)
|
516
|
+
|
517
|
+
{
|
518
|
+
|
519
|
+
if(ctrlbreak) {
|
520
|
+
|
521
|
+
return false;
|
522
|
+
|
523
|
+
}
|
524
|
+
|
525
|
+
ctrlbreak = true;
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
if(document.all) {
|
530
|
+
|
531
|
+
key = window.event.keyCode;
|
532
|
+
|
533
|
+
}
|
534
|
+
|
535
|
+
else {
|
536
|
+
|
537
|
+
key = event.which;
|
538
|
+
|
539
|
+
}
|
540
|
+
|
541
|
+
moveChar(String.fromCharCode(key));
|
542
|
+
|
543
|
+
}
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
function breakControl()
|
548
|
+
|
549
|
+
{
|
550
|
+
|
551
|
+
ctrlbreak = false;
|
552
|
+
|
553
|
+
}
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
function handleMouseDown(event) {
|
560
|
+
|
561
|
+
if(movingID != null) {
|
562
|
+
|
563
|
+
clearInterval(movingID);
|
564
|
+
|
565
|
+
movingID = null;
|
566
|
+
|
567
|
+
}
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
if(document.all) {
|
572
|
+
|
573
|
+
button = parent.input.event.srcElement.name;
|
574
|
+
|
575
|
+
}
|
576
|
+
|
577
|
+
else {
|
578
|
+
|
579
|
+
button = event.target.name;
|
580
|
+
|
581
|
+
}
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
switch(button) {
|
586
|
+
|
587
|
+
case 'left':
|
588
|
+
|
589
|
+
keych = '4'; break;
|
590
|
+
|
591
|
+
case 'right':
|
592
|
+
|
593
|
+
keych = '6'; break;
|
594
|
+
|
595
|
+
case 'up':
|
596
|
+
|
597
|
+
keych = '8'; break;
|
598
|
+
|
599
|
+
case 'down':
|
600
|
+
|
601
|
+
keych = '2'; break;
|
602
|
+
|
603
|
+
default:
|
604
|
+
|
605
|
+
keych = '5';
|
606
|
+
|
607
|
+
}
|
608
|
+
|
609
|
+
movingID = setInterval("moveChar('" + keych + "')", 60);
|
610
|
+
|
611
|
+
}
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
function handleMouseUp(event) {
|
616
|
+
|
617
|
+
if(movingID != null) {
|
618
|
+
|
619
|
+
clearInterval(movingID);
|
620
|
+
|
621
|
+
movingID = null;
|
622
|
+
|
623
|
+
}
|
624
|
+
|
625
|
+
}
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
function reloadFrame()
|
630
|
+
|
631
|
+
{
|
632
|
+
|
633
|
+
if(reloading) {
|
634
|
+
|
635
|
+
return;
|
636
|
+
|
637
|
+
}
|
638
|
+
|
639
|
+
reloading = true;
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
layer = domtool.getLayer("char0");
|
644
|
+
|
645
|
+
x = layer.getX();
|
646
|
+
|
647
|
+
y = layer.getY();
|
648
|
+
|
649
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y;
|
650
|
+
|
651
|
+
}
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
function moveChar(key)
|
656
|
+
|
657
|
+
{
|
658
|
+
|
659
|
+
var key2 = key;
|
660
|
+
|
661
|
+
if(reloading) {
|
662
|
+
|
663
|
+
return;
|
664
|
+
|
665
|
+
}
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
layer = domtool.getLayer("char0");
|
670
|
+
|
671
|
+
x = layer.getX();
|
672
|
+
|
673
|
+
y = layer.getY();
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
dx = 0;
|
678
|
+
|
679
|
+
dy = 0;
|
680
|
+
|
681
|
+
switch(key2) {
|
682
|
+
|
683
|
+
case '4': // left
|
684
|
+
|
685
|
+
dx = -mv;
|
686
|
+
|
687
|
+
if(x + dx < left) {
|
688
|
+
|
689
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=4";
|
690
|
+
|
691
|
+
reloading = true;
|
692
|
+
|
693
|
+
}
|
694
|
+
|
695
|
+
break;
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
case '6': // right
|
700
|
+
|
701
|
+
dx = mv;
|
702
|
+
|
703
|
+
if(x + dx + cell > left + width) {
|
704
|
+
|
705
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=6";
|
706
|
+
|
707
|
+
reloading = true;
|
708
|
+
|
709
|
+
}
|
710
|
+
|
711
|
+
break;
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
case '8': // up
|
716
|
+
|
717
|
+
dy = -mv;
|
718
|
+
|
719
|
+
// if(y + dy < top) {
|
720
|
+
|
721
|
+
if(y + dy < 0) {
|
722
|
+
|
723
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=8";
|
724
|
+
|
725
|
+
reloading = true;
|
726
|
+
|
727
|
+
}
|
728
|
+
|
729
|
+
break;
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
case '2': // down
|
734
|
+
|
735
|
+
dy = mv;
|
736
|
+
|
737
|
+
// if(y + dy + cell > top + height) {
|
738
|
+
|
739
|
+
if(y + dy + cell > 288 ) {
|
740
|
+
|
741
|
+
location.search = pathinfo + "&px=" + x + "&py=" + y + "&ctrl=2";
|
742
|
+
|
743
|
+
reloading = true;
|
744
|
+
|
745
|
+
}
|
746
|
+
|
747
|
+
break;
|
748
|
+
|
749
|
+
}
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
if(!reloading) {
|
754
|
+
|
755
|
+
layer.moveBy(dx, dy);
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
layer2 = domtool.getLayer("balloon0");
|
760
|
+
|
761
|
+
layer3 = domtool.getLayer("text0");
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
if(layer2.div && layer3.div) {
|
766
|
+
|
767
|
+
layer2.moveBy(dx, dy);
|
768
|
+
|
769
|
+
layer3.moveBy(dx, dy);
|
770
|
+
|
771
|
+
}
|
772
|
+
|
773
|
+
}
|
774
|
+
|
775
|
+
}
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
function getCharLeft()
|
780
|
+
|
781
|
+
{
|
782
|
+
|
783
|
+
return domtool.getLayer("char0").getX();
|
784
|
+
|
785
|
+
}
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
function getCharTop()
|
790
|
+
|
791
|
+
{
|
792
|
+
|
793
|
+
return domtool.getLayer("char0").getY();
|
794
|
+
|
795
|
+
}
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
function OnButtonClick1() {
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
if(CilckFlag1==1){
|
806
|
+
|
807
|
+
target = document.getElementById("output1");
|
808
|
+
|
809
|
+
target.innerHTML = "クリックされました!!";
|
810
|
+
|
811
|
+
CilckFlag1=0;
|
812
|
+
|
813
|
+
}else if(CilckFlag1==0){
|
814
|
+
|
815
|
+
target = document.getElementById("output1");
|
816
|
+
|
817
|
+
target.innerHTML = "クリックさてません。。。";
|
818
|
+
|
819
|
+
CilckFlag1=1;
|
820
|
+
|
821
|
+
}
|
822
|
+
|
823
|
+
}
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
コード
|
828
|
+
|
829
|
+
```
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
今、ボタンをクリックしても状態が変わらず、つまづいています。
|