javascript如何控制当浏览器的窗口变成某一固定值时,自动跳到精简模式?
有一段如下代码,我想改成当浏览器的窗口变成某一固定值时如变成300X300时,网页页面自动切换成精简模式,不需要再点设置好的精简按钮,急在线等,问题解决可追加分数。谢谢。...
有一段如下代码,我想改成当浏览器的窗口变成某一固定值时如变成300X300时,网页页面自动切换成精简模式,不需要再点设置好的精简按钮,急在线等,问题解决可追加分数。谢谢。
旧代码:
<SCRIPT language=JavaScript>
document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
function showsubmenu(){
whichEl = eval("itv163_list");
if (whichEl.style.display == "none") {
eval("itv163_list.style.display=\"\";");
parent.mainframe.rows = "0,*,0";
idFlag.innerHTML = "<img src='/tv/p2p/inc/turn_right.gif' title='按此切换到正常模式'>";
}
else {
eval("itv163_list.style.display=\"none\";");
parent.mainframe.rows = "0,*,0";
idFlag.innerHTML = "<img src='/tv/p2p/inc/turn_left.gif' title='按此切换到精简模式'>";
}
}
</SCRIPT> 展开
旧代码:
<SCRIPT language=JavaScript>
document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
function showsubmenu(){
whichEl = eval("itv163_list");
if (whichEl.style.display == "none") {
eval("itv163_list.style.display=\"\";");
parent.mainframe.rows = "0,*,0";
idFlag.innerHTML = "<img src='/tv/p2p/inc/turn_right.gif' title='按此切换到正常模式'>";
}
else {
eval("itv163_list.style.display=\"none\";");
parent.mainframe.rows = "0,*,0";
idFlag.innerHTML = "<img src='/tv/p2p/inc/turn_left.gif' title='按此切换到精简模式'>";
}
}
</SCRIPT> 展开
2个回答
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
function gaowei(){
window.resizeTo(500, 300);
}
</script>
</head>
<body onResize="gaowei()">
<form action="">
<fieldset>
<legend>gaowei</legend>
<input type="button" name="gaowei" id="gaowei" value="提交">
</fieldset>
</form>
</body>
</html>
我着急大致写了一下onResize="gaowei()"这个函数是在用户改变浏览器大小的时候触发的 大致思路就是这样你要怎么实现你就在里面加上判断语句来控制把
写不出来在给我发信息把 我有点忙 不好意思
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
window.onresize=function(){
var msg="\nwindow.onresize事件:\n\n";
msg+="用户改变了窗口尺寸";
alert(msg);
}
</script>
</head>
<body>
This is my HTML page. <br>
</body>
</html>
这个也是用户改变浏览器大小触发的函数 你试试哪个好用用哪个把
<html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
function gaowei(){
window.resizeTo(500, 300);
}
</script>
</head>
<body onResize="gaowei()">
<form action="">
<fieldset>
<legend>gaowei</legend>
<input type="button" name="gaowei" id="gaowei" value="提交">
</fieldset>
</form>
</body>
</html>
我着急大致写了一下onResize="gaowei()"这个函数是在用户改变浏览器大小的时候触发的 大致思路就是这样你要怎么实现你就在里面加上判断语句来控制把
写不出来在给我发信息把 我有点忙 不好意思
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
window.onresize=function(){
var msg="\nwindow.onresize事件:\n\n";
msg+="用户改变了窗口尺寸";
alert(msg);
}
</script>
</head>
<body>
This is my HTML page. <br>
</body>
</html>
这个也是用户改变浏览器大小触发的函数 你试试哪个好用用哪个把
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询