|
<STRONG>网页初学者必学内容!<BR><BR><!----><BR></STRONG><FONT size=2>在网页中加入各种特效 <BR><BR>1。禁止右键 <BR> <body oncontextmenu="return false"> <BR> 或 <BR> <body style="overflow-y:hidden"> <BR>2。加入背景音乐 <BR> IE:<bgsound src="*.mid" loop=infinite> <BR> NS:<embed src="*.mid" autostart=true hidden=true loop=true> <BR> </embed> <BR> *.mid你的背景音乐的midi格式文件 <BR>3。简单的window.open方法 <BR> <a href="#" <BR> onclick="javascript :window.open(文件路径/文件名,newwindow, <BR> toolbar=no,scrollbars=yes,resizable=no,top=0,left=0, <BR> width=400,height=300);">文字或图片</a> <BR> 参数解释: <BR> <script LANGUAGE="javascript"> js脚本开始; <BR> window.open 弹出新窗口的命令; <BR> 文件路径/文件名 弹出窗口的文件名; <BR> newwindow 弹出窗口的名字(不是文件名),非必须,可用空代替; <BR> width=400 窗口宽度; <BR> height=300 窗口高度; <BR> top=0 窗口距离屏幕上方的象素值; <BR> left=0 窗口距离屏幕左侧的象素值; <BR> toolbar=no 是否显示工具栏,yes为显示; <BR> menubar,scrollbars 表示菜单栏和滚动栏。 <BR> resizable=no 是否允许改变窗口大小,yes为允许; <BR> location=no 是否显示地址栏,yes为允许; <BR> status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许; <BR> </script> js脚本结束 <BR>4。简单的页面加密 <BR> <script LANGUAGE="javascript"> <BR> <!-- <BR> function loopy(){ <BR> var sWord =""; <BR> while(sWord!="login"){sWord=prompt("请输入你的登陆密码");} <BR> alert("登陆成功!"); <BR> } <BR> loopy() <BR> //--> <BR> </script> <BR>5。拉动页面时背景图不动 <BR> <style> <BR> body{background-image:url(logo.gif); <BR> background-repeat:no-repeat;background-position:center} <BR> </style> <BR>6。让浏览器在保存页面时保存失败 <BR> <NOscript><iframe src="*.html"></iframe></NOscript> <BR>7。随机替换图片 <BR> <script> <BR> document.write(<img src="img/+parseInt(Math.random()*(5)) <BR> +.gif"height="40" width="50">) <BR> </script> <BR><BR> 图片文件名为0.gif 1.gif 2.gif 3.gif 4.gif <BR>8。窗口定时关闭 <BR> 先将如下代码网页文件的区: <BR> <script language="javascript"> <BR> function closeit() { setTimeout("self.close()",10000) //毫秒 } <BR> </script> <BR> 然后再在<body>标内加入如:<body onload="closeit()"> <BR>9。网页自动关闭 <BR> <html> <BR> <head> <BR> <object id=closes type="application/x-oleobject" <BR> classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <BR> <param name="Command" value="Close"> <BR> </object> <BR> </head> <BR> <body onload="window.setTimeout(closes.Click(),10000)"> <BR> 这个窗口会在10秒过后自动关闭,而且不会出现提示. <BR> </body> <BR> </html> <BR>10。网页自动刷新 <BR> 在head部记入 <BR> <meta HTTP-EQUIV="Refresh" content="20"> <BR> 其中20为20秒后自动刷新,你可以更改为任意值。 <BR>11。网页自动转页 <BR> <meta HTTP-EQUIV="Refresh" CONTENT="时间(秒);URL=地址"> <BR>12。保持layer在最前面,而不被Iframe、Object所覆盖 <BR> 在Layer中再插Iframe 或 Object 设z-Index值 <BR> <div z-Index:2><object ***></object> # 前面 <BR> <div z-Index:1><object ***></object> # 后面 <BR> <div id="Layer2" style="position:absolute; top:40;width:400px; <BR> height:95px;z-index:2"> height=100% width=100%> <BR> <iframe width=0 height=0></iframe> <BR> </div> <BR> <div id="Layer1" style="position:absolute; top:50;width:200px; <BR> height:115px;z-index:1"> <BR> <iframe height=100% width=100%></iframe> <BR> </div> <BR>13。返回上一页 <BR> <a href=javascript :history.back(1)>『返回上一页』</a> <BR>14。关闭窗口 <BR> <a href=javascript :self.close()>『关闭窗口』</a> <BR>15。关于iframe的透明背景 <BR> <IFRame ID="iFrame1" SRC="iframe.htm" <BR> allowTransparency="true" <BR> style="background-color: green"></IFRame></FONT><BR> |
|