mmmm, kan iemand me dan vertellen wat er fout is aan:
if((x == 3) || (x == 4) || (x == 5))
Niets, maar x zal nooit gelijk zijn aan 3, 4 of 5, x is gewoon x en daarmee houdt het op. Of moet x soms de variabele $x zijn?
x is inderdaad een variabele, maar in JavaScript hoef je dat niet aan te geven met een tekentje.
als ik een scriptje maak gebaseerd op dit verhaal werkt het volgende :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>test</title>
<script language="JavaScript">
function ik(){
var x = 3;
if((x == 3) || (x == 4) || (x == 5)){
document.write('hallo');
}
else{
document.write('????');
}
}
</script>
</head>
<body bgcolor="#ffffff">
<form action="test.html" name="testpage">
<button name="test" onclick="ik()" type="button">Button</button>
</form>
</body>
</html>