Javascript网页脚本应用教程之二
有没有可能用层来遮住FLASH?
1.在flash的parameters里加入 <param name="wmode" values="transparent">
2.<body onblur=self.focus()>
如何根据屏幕分辨率调用相对应的页面?
先做好几个页面,比如一个htm1.htm是800*600,一个是htm2.htm是1024*768的
然后在你的入口页面 index.htm 中判断:
HTML 代码片段如下:
<html>
<head>
<script language=<B>javascript</B>>
<!--
function mHref() {
if (screen.width == 1024) location.href = "htm2.htm";
else if (screen.width == 800) location.href = "htm1.htm";
else return(false);
}
//-->
</script>
</head>
<body onload="mHref();">
</body>
</html>
不用询问就关闭浏览器
HTML 代码片段如下:
<head>
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body>
<input type="button" value="点击我关闭窗口" onclick="closes.Click();">
</body>
如何弹出只有状态栏的窗口?
HTML 代码片段如下:
<html>
<head>
<title>open() close()</title>
<script language="<B>javascript</B>" type="text/<B
style="color:black;background-color:#A0FFFF">javascript</B>">
<!--
function openWin()
{
var newWin=open("","","menubar=1,height=200");
newWin.document.write("<form>");
newWin.document.write("单击以下按钮关闭窗口:<p>");
newWin.document.write("<input type=button value='关闭' onclick=window.close()>");
newWin.document.write("</form>");
}
</script></head>
<body>
<div align=center>
<h2>单击以下按钮显示新窗口...</h2>
<form name=form1>
<input type=button value="新窗口1[只显示地址栏]" onclick=window.open('','new1','location=1')>
<input type=button value="新窗口2[只显示状态栏]" onclick=window.open('','','status=1')>
<input type=button value="新窗口3[只显示工具栏]" onclick=window.open('','new2','toolbar=1,height=200,width=450')>
<input type=button value="新窗口4[只显示菜单栏]" onclick=openWin()>
<input type=button value="新窗口5[一个不少]" onclick=window.open('','new5')>
<input type=button value="新窗口6[光棍但可调大小]" onclick=window.open('http://www.51js.com/forumdisplay.php?forumid=32#thread','new6','resizable=1')>
</form>
</div>
</body>
</html>