var gravity = 9.8;
var jump = 0;
var mumpspeed = 5;

function main(){
while(1){
if(key_cuu && player hitting platform){
jump = 1;
}
else if(player hitting platform){
jump = 0;
}

if(jump){
player.z += jumpspeed;
}

player.z -= jumpspeed;
}
}

It should be along the lines of that. Look at it, experiment, and modify to fit your uses.