var playbtn = new Image(); var pausebtn = new Image(); var playing = true; var stoping = false; playbtn.src = "style/controls_play.gif"; pausebtn.src = "style/controls_pause.gif"; function togglePlay(){ if (document.getElementById) imgObj = document.getElementById('play_pause'); // ie5/ns6 else if (document.layers) imgObj = document.container.document.controls.document.play_pause; // ns4 else imgObj = document.play_pause; // ie4 if (playing) { ss.pause() playing = false; stoping = true; imgObj.src = playbtn.src; } else { if(stoping) ss.next();ss.play() playing = true; stoping = false; imgObj.src = pausebtn.src; } }