JS werkt niet
Hallo Iedereen, ik probeer een browser-basic spel te maken maar JS werkt bij mij niet... Kan iemand even kijken wat er loos is?
Als iemand veel verstand heeft van JS dan reply plz...
Of een betere versie sturen...
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<HTML>
<HEAD>
<STYLE TYPE="text/css">
<!--
#thumbblok {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}
//-->
</STYLE>
<script language=javascript>
menu = "<button onclick='javascript:window.location.reload(\"./battle.php?mode=find\");'>Find a wild creature</button><br><br><button onclick='javascript:window.location.reload(\"./battle.php?mode=pvp\");'>Attack another player</button>";
shop = "Normal Sword<br>Type: Sword<br>Cost: 5<br><button onclick=\"javascript:window.location.reload('./shop.php?mode=buy&item=1');\">Buy 1 Normal Sword</button>";
inve = "";
quip = "Weapon Hand: <A onmouseover='popup(\"Normal Sword<br>Required level: 1<br><br>Type: Sword<br><br>Attack: +3<br>Defense: +0\", \"0\");' onmouseout='stopthumb();'></A><br>Shield Hand: Nothing<br><br>Chest: Nothing<br>Back: Nothing<br>Legs: Nothing<br>Chest: Nothing<br>';
<!--
Xoffset= 16; // modify these values to ...
Yoffset= 16; // change the popup position.
var old,skn,iex=(document.all),yyy=-1000;
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;
if (ns4) {
skn=document.thumbblok;
}
else if (ns6) {
skn=document.getElementById("thumbblok").style;
}
else if (ie4) {
skn=document.all.thumbblok.style;
}
if(ns4)
{
document.captureEvents(Event.MOUSEMOVE);
}
else
{
skn.visibility="visible";
skn.display="none";
}
document.onmousemove=get_mouse;
function popup(msg,bak){
var content="<TABLE WIDTH=80 BORDER=1 bordercolor=#000000 CELLPADDING=0 CELLSPACING=0><TD ALIGN=center><FONT COLOR=black SIZE=2>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible";}
if(ns6){document.getElementById("thumbblok").innerHTML=content;skn.display='';}
if(ie4){document.all("thumbblok").innerHTML=content;skn.display='';}
}
function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}
function stopthumb(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
{
skn.display="none";
}
}
//-->
</script>
</HEAD>
<body onload="container.innerHTML = menu">
Battlez: Ikkerens<br>
<button onclick="container.innerHTML = menu">Menu</button>
<button onclick="container.innerHTML = shop">Shop</button>
<button onclick="container.innerHTML = inve">Inventory</button>
<button onclick="container.innerHTML = quip">Equip</button>
<br><br>
Level: 1<br>
Exp: 0/80<br><br>
<DIV ID="container">
</DIV>
<DIV ID="thumbblock">
</DIV>
</body>
</html>
<HEAD>
<STYLE TYPE="text/css">
<!--
#thumbblok {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}
//-->
</STYLE>
<script language=javascript>
menu = "<button onclick='javascript:window.location.reload(\"./battle.php?mode=find\");'>Find a wild creature</button><br><br><button onclick='javascript:window.location.reload(\"./battle.php?mode=pvp\");'>Attack another player</button>";
shop = "Normal Sword<br>Type: Sword<br>Cost: 5<br><button onclick=\"javascript:window.location.reload('./shop.php?mode=buy&item=1');\">Buy 1 Normal Sword</button>";
inve = "";
quip = "Weapon Hand: <A onmouseover='popup(\"Normal Sword<br>Required level: 1<br><br>Type: Sword<br><br>Attack: +3<br>Defense: +0\", \"0\");' onmouseout='stopthumb();'></A><br>Shield Hand: Nothing<br><br>Chest: Nothing<br>Back: Nothing<br>Legs: Nothing<br>Chest: Nothing<br>';
<!--
Xoffset= 16; // modify these values to ...
Yoffset= 16; // change the popup position.
var old,skn,iex=(document.all),yyy=-1000;
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;
if (ns4) {
skn=document.thumbblok;
}
else if (ns6) {
skn=document.getElementById("thumbblok").style;
}
else if (ie4) {
skn=document.all.thumbblok.style;
}
if(ns4)
{
document.captureEvents(Event.MOUSEMOVE);
}
else
{
skn.visibility="visible";
skn.display="none";
}
document.onmousemove=get_mouse;
function popup(msg,bak){
var content="<TABLE WIDTH=80 BORDER=1 bordercolor=#000000 CELLPADDING=0 CELLSPACING=0><TD ALIGN=center><FONT COLOR=black SIZE=2>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible";}
if(ns6){document.getElementById("thumbblok").innerHTML=content;skn.display='';}
if(ie4){document.all("thumbblok").innerHTML=content;skn.display='';}
}
function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}
function stopthumb(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
{
skn.display="none";
}
}
//-->
</script>
</HEAD>
<body onload="container.innerHTML = menu">
Battlez: Ikkerens<br>
<button onclick="container.innerHTML = menu">Menu</button>
<button onclick="container.innerHTML = shop">Shop</button>
<button onclick="container.innerHTML = inve">Inventory</button>
<button onclick="container.innerHTML = quip">Equip</button>
<br><br>
Level: 1<br>
Exp: 0/80<br><br>
<DIV ID="container">
</DIV>
<DIV ID="thumbblock">
</DIV>
</body>
</html>
Als iemand veel verstand heeft van JS dan reply plz...
Of een betere versie sturen...
Gewijzigd op 01/01/1970 01:00:00 door Rens Rikkerink
Hoe werkt dat programma?
(Script Debugger)
(Script Debugger)
https://addons.mozilla.org/nl/firefox/addon/1843
firebug is ook duidelijk om fouten mee uit je js code te halen..
firebug is ook duidelijk om fouten mee uit je js code te halen..
@Terence: Klopt, maar IE ondersteund geen 'normale' JS.
'Jonathan:
@Terence: Klopt, maar IE ondersteund geen 'normale' JS.
Ook geen "normale" CSS code...
'normale' JS????
wat is dat dan?
wat is dat dan?
Ik heb ook geen idee. Enige waar IE, Firefox en Webkit qua syntax in verschillen is eigenlijk het gezeik over punt-komma's, komma's en list(). Maar dat is gewoon te verhelpen middels netjes werken. Dat de API's hier en daar wat anders zijn, daar is weinig aan te doen. Gebrek aan standaarden zeg maar :) Maar daar is gelukkig heel gemakkelijk omheen te werken, in tegenstelling tot de verschillen in CSS.
Die script debugger werkt trouwens heel simpel. Je zet hem 'aan' in je Internet Instellingen, en je wacht tot er een fout komt. Dan vraag IE of je de Script Debugger wilt openen, dan druk je op 'ja', en dan is hij vergelijkbaar met het Javascript-deel van Firebug. En met de IE Developer Toolbar heb je ook het DOM gedeelte van Firefox ongeveer in Internet Explorer.
Die script debugger werkt trouwens heel simpel. Je zet hem 'aan' in je Internet Instellingen, en je wacht tot er een fout komt. Dan vraag IE of je de Script Debugger wilt openen, dan druk je op 'ja', en dan is hij vergelijkbaar met het Javascript-deel van Firebug. En met de IE Developer Toolbar heb je ook het DOM gedeelte van Firefox ongeveer in Internet Explorer.




