0
Meine html finden:JavaScript kippt Funktion in Onclick Attribute
<!doctype hmtl>
<html>
<head>
</head>
<body>
<script type='text/javascript'>
var playerId = 1;
function event(action) {
let req = new XMLHttpRequest('/act?id='+String(playerId)+'&action='+action);
alert(action);
}
</script>
<img src="up.png" width='100' height='100' onclick='event("up");'>
<img src="down.png" width='100' height='100' onclick='event("down");'>
<img src="left.png" width='100' height='100' onclick='event("left");'>
<img src="right.png" width='100' height='100' onclick='event("right");'>
<img src="fire.png" width='100' height='100' onclick='event("fire");'>
</body>
</html>
ich sicher weiß das Bild anklickbar ist. Aber warum sagt die Fehlermeldung event is not a function
? Ich brauche Hilfe.
einfach die Funktion umbenennen; "Event" ist nicht erlaubt. –
Danke! Das ist die Antwort. –