1、页面全屏
页面全屏显示[ALT+F4关闭][共1步][新弹出窗口并以全屏幕方式显示] ====1、将以下代码加入HTML的<body></body>之间: <form> <div align="center"> <input type="BUTTON" name="FullScreen" value="全屏显示" onClick="window.open(document.location, ‘big‘, ‘fullscreen=yes‘)"> </div> </form>
2、显示器检测代码(给出提示)
显示器检测代码[共1步][如果对方的分辨率不是800*600就出现提示文字] [你可以改一下分辨率试一下] ====1、将以下代码加入HEML的<body></body>之间: <script language="JavaScript1.2"> <!-- var correctwidth=800 var correctheight=600 if (screen.width!=correctwidth||screen.height!=correctheight) document.write("本站最佳分辨率: "+correctwidth+"*"+correctheight+". 你当前的分辨率是:"+screen.width+"*"+screen.height+"。设置合适的分辨率才能取得最佳的显示效果!") //--> </script>
3、浏览器检测后自动调相应页面转
浏览器检测后自动调相应页面转[共1步] [自动检测是IE还是NS然后根据结果自动专到相应页面避免浏览器的不兼容导致的页面浏览异常] ====1、将以下代码加入HTML的<head></head>之间: <SCRIPT LANGUAGE="JavaScript"> <!-- Start Code var ver = navigator.appVersion; if (ver.indexOf("MSIE") != -1) { window.location.href="IE的页面.htm" }else window.location.href="NS的页面.htm" // End Code --> </SCRIPT>
4、检测浏览器版本信息
检测浏览器版本信息[检测浏览器.操作系统.的简易代码][共1步] ====1、将以下代码加入HTML的<BODY>区即可: <script> document.write("版本 "+navigator.appVersion); </script>
5、页面停留时间
一、页面停留时间1[共2步] ====1、将以下代码加入HTML的<head></head>之间: <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var ap_name = navigator.appName; var ap_vinfo = navigator.appVersion; var ap_ver = parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf(‘(‘))); var time_start = new Date(); var clock_start = time_start.getTime(); var dl_ok=false; function init () { if(ap_name=="Netscape" && ap_ver>=3.0) dl_ok=true; return true; } function get_time_spent () { var time_now = new Date(); return((time_now.getTime() - clock_start)/1000); } function show_secs () // show the time user spent on the side { var i_total_secs = Math.round(get_time_spent()); var i_secs_spent = i_total_secs % 60; var i_mins_spent = Math.round((i_total_secs-30)/60); var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent); var s_mins_spent ="" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent); document.fm0.time_spent.value = s_mins_spent + ":" + s_secs_spent; window.setTimeout(‘show_secs()‘,1000); } // --> </SCRIPT> ====2、将以下代码加入HTML的<body></body>之间: <BODY onLoad="init(); window.setTimeout(‘show_secs()‘,1);"> <form name="fm0" onSubmit="0"> <font size="-1"><I><FONT COLOR="#888888">您在本网页的停留时间:</FONT></I></font><br> <INPUT type="text" name="time_spent" size=7 onFocus="this.blur()"> </form> 二、页面停留时间2[离开时弹出提示框][共1步] ====1、将以下代码加入HEML的<body></body>之间: <script LANGUAGE="Javascript"> <!-- Begin pageOpen = new Date(); function bye() { pageClose = new Date(); minutes = (pageClose.getMinutes() - pageOpen.getMinutes()); seconds = (pageClose.getSeconds() - pageOpen.getSeconds()); time = (seconds + (minutes * 60)); if (time == 1) { time = (time + " second"); } else { time = (time + " seconds"); } alert(‘您在本页停留了‘ + time + ‘.谢谢!!‘); } // End --> </script> <body onUnload="bye()">
6、检测浏览器类型并调用不同的背景音乐
检测浏览器类型并调用不同的背景音乐[修改MIDI文件名][共1步] ====1、将以下代码加入HTML的<body></body>之间: <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var MSIE=navigator.userAgent.indexOf("MSIE"); var NETS=navigator.userAgent.indexOf("Netscape"); var OPER=navigator.userAgent.indexOf("Opera"); if((MSIE>-1) || (OPER>-1)) { document.write("<BGSOUND SRC=sound.mid LOOP=INFINITE>"); } else { document.write("<EMBED SRC=sound2.mid AUTOSTART=TRUE "); document.write("HIDDEN=true VOLUME=100 LOOP=TRUE>"); } // End --> </SCRIPT
JavaScript特效源码(6、页面特效一)
时间: 2024-10-10 21:39:33