I have following code, why doesn't it work. I'm new to html / javascript so sorry for it.

[code]

<script type="text/javascript">

function ShowPhoto() {
var code = prompt("Enter number:");

if (code == 1) {
image1 = newImage();
image1.src = "/fotos/201201/01.jpg";
}
if (code == 2) {
image1 = newImage();
image1.src = "/fotos/201201/02.jpg";
}
}
</script>
</head>
<body onload=ShowFoto()>
</body>