The fourth workshop for the Javascript unit is now available. YOU SHOULD ONLY DO THIS WORKSHOP IF YOU ARE IN TEAM SKYWALKER. NO CREDIT WILL BE GIVEN IF YOU ARE IN TEAM SOLO – although if you want to do some extra work, fill your boots! Just make sure you’ve done your own work first!
Follow this link to log in and do the workshop.
Again me!!! I’m trying to do the silver option, as it says on button two function, i am using an IF function and a variable. It works great but it is not correct to achieve the silver and I want to know what I’m missing here. Thanks
var action = 1;
function open()
{
document.getElementById(“jackbox”).src = “http://fetlar.kingston.ac.uk/pp/jackbox-open.jpg”;
}
function close()
{
document.getElementById(“jackbox”).src = “http://fetlar.kingston.ac.uk/pp/jackbox-closed.jpg”
}
function change()
{
if ( action == 1 ) {
open();
action = 2;
} else {
close();
action = 1;
}
}
document.getElementById(“toggle”).onclick = change;