-4
Я полный noob, когда дело доходит до javascript, но я не понимаю, почему я получаю ссылочную ошибку, когда я пытаюсь сыграть в игру «голова или хвост».javascript с левой стороны ошибка
document.write("
<button type='button' onclick='kop()'>kop</button></br>
<button type='button' onclick='munt()'>munt</button>
</br></br></br>
<button type='button' onclick='score()'>Score</button>
<p id='ww'></p>
<p id='ll'></p>
</br></br></br>
<p id='wi'></p>
<p id='lo'></p>
");
function kop(){
var keuze="kop";
var out=Math.floor(Math.random()*10+1);
if(out>5){
alert("het is inderdaad "+keuze+"!");
document.getElementById("ww")=document.getElementById("ww")+" ";
}else{
alert("het was munt!!");
document.getElementById("ll")=document.getElementById("ll")+" ";
}
}
function munt(){
var keuze="munt";
var out=Math.floor(Math.random()*10+1);
if(out<=5){
alert("het is inderdaad "+keuze+"!");
document.getElementById("ww")=document.getElementById("ww")+" ";
}else{
alert("het was kop!!");
document.getElementById("ll")=document.getElementById("ll")+" ";
}
};
function score(){
document.getElementById("wi")=document.getElementById("ww").length ;
document.getElementById("lo")=document.getElementById("ll").length;
}
И ошибка вы получаете это .. . – Charlie74
Добро пожаловать в StackOverflow. Прочитайте это о том, как правильно спросить qustions здесь: http://stackoverflow.com/help/asking –
Что JS будет бросать * Не выучить SyntaxError: Неожиданный токен ILLEGAL *, а не ссылочная ошибка. – Quentin