Problem playing one sound and then other

Yes, but i dont understand why:

song1.play();
while ( song1.isPlaying()){
//do nothing
}
song2.play();

should work, but firefox and chrome got stuck…