<script> function test(){ window.open('c.htm','tese','fullscreen=yes'); } </script> <body style="overflow:hidden;"> <input type="button" onclick="test();" value="全屏"> <pre> sdfsadfsadfsadf sdf a asdf as df sa d f asdf s adf sad f asdf sa f sa df s df sd f sadf asdf sa df sad f asf a df sad f sd fs d fs adf sa df sad f sa dfs adf s adf sad f sad f sad f sad f sad f sadf safd sa df sa df sad fs ad f sdf sad f sad f sadf saf </pre></body>
就可以隐藏滚动条了.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Flash全屏功能测试</title>
<style type="text/css">
<!--
body,td,th {
font-family: Courier New, Courier, monospace;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body>
<div id="flashcontent" style="width:400px;height:300px;"></div>
<script language="javascript" src="js/swfobject.js"></script>
<script language="JavaScript">
var orginFlash = {init:false,isFullScreen:false,position:"",top:"",left:"",width:"",height:""};
function writeFlash(){
var so = new SWFObject("fullscreen.swf", "fplayer", "100%", "100%", 8, "#FFFFFF");
so.addParam("quality", "high");
so.addParam("swLiveConnect", "true");
so.addParam("menu", "false");
so.addParam("allowScriptAccess", "sameDomain");
so.addParam("allowFullScreen", "true");
so.write("flashcontent");
}
function getScreenSize(){
var w = 0;
var h = 0;
if( typeof( window.innerWidth ) == 'number' ) {
w = window.innerWidth;
h = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
w = document.body.clientWidth;
h = document.body.clientHeight;
}
return {width:w,height:h};
}
function fullScreen(){
if(!orginFlash.init){
orginFlash.position = document.getElementById("flashcontent").style.position;
orginFlash.top = document.getElementById("flashcontent").style.top;
orginFlash.left = document.getElementById("flashcontent").style.left;
orginFlash.width = document.getElementById("flashcontent").style.width;
orginFlash.height = document.getElementById("flashcontent").style.height;
}
orginFlash.init = true;
orginFlash.isFullScreen = true;
var screenSize = getScreenSize();
try{
document.getElementById("flashcontent").style.position = "absolute";
document.getElementById("flashcontent").style.top = "0px";
document.getElementById("flashcontent").style.left = "0px";
document.getElementById("flashcontent").style.width = screenSize.width +"px";
document.getElementById("flashcontent").style.height = screenSize.height +"px";
document.body.style.overflow="hidden";
window.scrollTo(0,0);
}catch(e){
}
}
function normal(){
if(orginFlash.init){
orginFlash.isFullScreen = false;
try{
document.getElementById("flashcontent").style.position = orginFlash.position;
document.getElementById("flashcontent").style.top = orginFlash.top;
document.getElementById("flashcontent").style.left = orginFlash.left;
document.getElementById("flashcontent").style.width = orginFlash.width;
document.getElementById("flashcontent").style.height = orginFlash.height;
document.body.style.overflow="auto";
}catch(e){
}
}
}
function reSize(){
if(orginFlash.isFullScreen){
fullScreen();
}
}
window.onresize = reSize;
writeFlash();
</script>
</body>
</html>做成FLASH
function test(){
window.open('c.htm','tese','fullscreen=yes');
}
</script>
<body style="overflow:hidden;">
<input type="button" onclick="test();" value="全屏">
<pre>
sdfsadfsadfsadf
sdf
a
asdf
as
df
sa
d
f
asdf
s
adf
sad
f
asdf
sa
f
sa
df
s
df
sd
f
sadf asdf
sa
df
sad
f
asf
a
df
sad
f
sd
fs
d
fs
adf
sa
df
sad
f
sa
dfs
adf
s
adf
sad
f
sad
f
sad
f
sad
f
sad
f
sadf safd
sa
df
sa
df
sad
fs
ad
f
sdf
sad
f
sad
f
sadf
saf
</pre></body>
http://www.51ganen.cn/test/c.htm 状态栏和标题栏还是去不掉,我浏览器6.0的。
所以禁止使用脚本初始化窗口.而你本地的html文件,浏览器认为此是安全的网站,所以js没有限制.
所以问题出来了.你想使用js得到全屏效果.就必须手动修改你浏览器的设置
(IE选项->安全->自定义选项->把"允许由脚本初始化的窗口,没有大小和位置的限制"设为启用)