屏保效果

<button onclick="showFull();">全屏</button>

<button onclick="delFull();">退出全屏</button>


<div id="container"></div>

<script>

function showFull(){

var full=document.getElementById("container");

launchIntoFullscreen(full);

}


function delFull() {

exitFullscreen();

}


function launchIntoFullscreen(element) {

if(element.requestFullscreen){

element.requestFullscreen();

}

else if(element.mozRequestFullScreen) {

element.mozRequestFullScreen();

}

else if(element.webkitRequestFullscreen) {

element.webkitRequestFullscreen();

}

else if(element.msRequestFullscreen) {

element.msRequestFullscreen();

}

}


function exitFullscreen() {

if(document.exitFullscreen) {

document.exitFullscreen();

} else if(document.mozCancelFullScreen) {

document.mozCancelFullScreen();

} else if(document.webkitExitFullscreen) {

document.webkitExitFullscreen();

}

}

</script>