Something goes wrong in my script. I'm all new to it so i don't know
much yet.
I have a set of buttons. And when you click on either of them, the
background image will change. Only it's not working. It works when i
click on one, but then when i want to click on another, it's not
working.
What am i doing wrong?
thanks in advance
<html><head><ti tle></title>
<script type="text/javascript">
var buttons="<img src=\"buttonroo d2.jpg\"
onclick=\"print _waarde0()\"><i mg src=\"buttongro en2.jpg\"
onclick=\"print _waarde1()\"><i mg src=\"buttongee l2.jpg\"
onclick=\"print _waarde2()\"><i mg src=\"buttonbla uw2.jpg\"
onclick=\"print _waarde3()\"><i mg src=\"buttonora nje2.jpg\"
onclick=\"print _waarde4()\"><i mg src=\"buttonmag enta2.jpg\"
onclick=\"print _waarde5()\"><i mg src=\"buttoncya an2.jpg\"
onclick=\"print _waarde6()\">";
function print_waarde0() {
var a = "achtergrondroo d.jpg";
var top = '<html><body background="' + a + '">';
var bottom = "</body></html>";
document.write( top+buttons+bot tom);
}
function print_waarde1() {
var b = "achtergrondgro en.jpg";
var top1 = '<html><body background="' + b + '">';
var bottom1 = "</body></html>";
document.write( top1+buttons+bo ttom1);
}
function print_waarde2() {
var c = "achtergrondgee l.jpg";
var top2 = '<html><body background="' + c + '">';
var bottom2 = "</body></html>";
document.write( top2+buttons+bo ttom2);
}
function print_waarde3() {
var d = "achtergrondbla uw.jpg";
var top3 = '<html><body background="' + d + '">';
var bottom3 = "</body></html>";
document.write( top3+buttons+bo ttom3);
}
function print_waarde4() {
var e = "achtergrondora nje.jpg";
var top4 = '<html><body background="' + e + '">';
var bottom4 = "</body></html>";
document.write( top4+buttons+bo ttom4);
}
function print_waarde5() {
var f = "achtergrondmag enta.jpg";
var top5= '<html><body background="' + f + '">';
var bottom5 = "</body></html>";
document.write( top5+buttons+bo ttom5);
}
function print_waarde6() {
var g = "achtergrondcya an.jpg";
var top6 = '<html><body background="' + g + '">';
var bottom6 = "</body></html>";
document.write( top6+buttons+bo ttom6);
}
</script>
</head>
<body background="pae ceachtergrond.j pg" bgproperties="f ixed">
<h2>Welkom op Understanding Colors!</h2><br>
<font face="georgia">
Do you want to change the background?<br>
Choose from the following buttons and click on one.<br>
<body>
<img src="buttonrood 2.jpg" onclick="print_ waarde0()">
<img src="buttongroe n2.jpg" onclick="print_ waarde1()">
<img src="buttongeel 2.jpg" onclick="print_ waarde2()">
<img src="buttonblau w2.jpg" onclick="print_ waarde3()">
<img src="buttonoran je2.jpg" onclick="print_ waarde4()">
<img src="buttonmage nta2.jpg" onclick="print_ waarde5()">
<img src="buttoncyaa n2.jpg" onclick="print_ waarde6()">
<br>
<br>
Op deze site kan je alles lezen over kleur en wat er mee te maken
heeft.<br>
</body>
</html>