delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks

Windows任务栏上显示网页的超酷玩法!!!!!!!!!!! 作者:lee1892 -----------整理者:lnboy 众所周知,windows的任务栏可以显示一个被称为QuickLaunch的快捷工具按钮栏,也可以添加一个指定的目录,并显示该目录下所有文件的按钮。 可您是否知道它还能显示一个html文件的内容吗?它确实可以! 您能想象这有什么作用吗?很有意思的,一起来看看吧。 在任务栏上右键 -> 工具栏 ->新建工具栏.. javascript:window.location.replace("file:///D:/ToolBar/Time/index.html") -------------------------------------------------------------------------------- (此处以位于D:\ToolBar\Time目录下名为index.html的文件为例,此文件稍后给出),这时在Taskbar上会出现java script:window.location等等字样,右键于该字样并刷新之,又可能出现server not found之类的字样,继续右键并刷新之,应该出现该html文件的标题了,调整一下此栏的宽度就可以看到它的内容了。刷新期间,可能会有诸如权限限制之类的对话框跳出,一律yes之。强调一下,是刷新两次。(刷新的时候可能会提示脚本有错,不用理它,多刷新几次就好了) 以下是前述的Time的HTML的源文件 代码:--------------------------------------------------------------------------------<!-- Time--> <html> <head> <title>Time</title> <style> body { border: 0; background-color: buttonface; color: black; margin: 3px,0,0,0 } .clocktxt { font-family: Arial; font-weight: normal; font-size: 8pt } #btnsd { border: 2px groove white; background-color: buttonface; font-family: verdana; font-size: 9px } </style> <script language="JavaScript"> //Clock Script var showclock; function init(){ showdate() showclock=true; } function showdate(){ //edit refresh rate here var refreshrate=1000; var Clock=new Date() var hours=Clock.getHours() var minutes=Clock.getMinutes() var seconds=Clock.getSeconds() var dn="AM" if (hours>12){ dn="PM" hours=hours-12 } if (hours==0) hours=12 if (minutes<=9) minutes= "0" + minutes if (seconds<=9) seconds= "0" + seconds //edit format here format = hours+":"+minutes+":"+seconds+" "+dn; Time.innerHTML=format; if (showclock==false) Time.innerHTML="<input type='button' value='Sh.time' id='btnsd' title='Show time'>" else setTimeout("showdate()",refreshrate) } </script> </head> <body scroll="no" onLoad="init()"> <center> <font class="clocktxt"> <span id="Time" style="position:center;"></span></font> </body> </html> 这样,你就可以在任务栏看到一个时间的显示了。 OK,我们已经知道如何在任务栏上显示HTML文件了。接下来我想您一定知道如何把它拖到边上吧,就是用鼠标点住标题先拖到桌面上,变成一个窗口,再往屏幕边上拖,这样就变成一个Sidebar乐。您可以设置是否自动隐藏、是否永远在最上端等。 在给出几个例子前,先说说写这种HTML的一些小诀窍。 1. 显示与任务栏颜色相同的背景色 在<head>段里加入 代码:--------------------------------------------------------------------------------<Style> body { border-width : 0 ; background-color: buttonface; ... }</Style>-------------------------------------------------------------------------------- 这样当更换Theme时,回一同更换 2. 自动刷新页面 有些情况下会希望网页自动刷新,可以在<head>段里加入 代码:--------------------------------------------------------------------------------<meta http-equiv="Refresh" content="60">-------------------------------------------------------------------------------- content的数字应该是秒吧(记不清了,呵呵) 3. 禁止滚动条 代码:--------------------------------------------------------------------------------<body scroll="no">-------------------------------------------------------------------------------- 4. 设置页面的边距 在body的style设定里加入 代码:-------------------------------------------------------------------------------- margin: 2,2,2,2 -------------------------------------------------------------------------------- 差点忘了说,我的机子上,必须在任务栏上加新的,也就是说每加一个新的必须从头做起(在任务栏上右键...拖到桌面再拖到边上),不知道您得是否也这样 下面是几个示例的部分代码: 示例一: 万年历 代码:--------------------------------------------------------------------------------HTML QuickLaunch /// Calendar by Lee1892 Original file from http://hohula.myetang.com/html/calendar.html java script:window.location.replace("file:///x:/.../Calendar/index.html") You can change the rows 1246-1262 to hide or show some parts. for example to hide part WorldTime, change line 1246 and 1247 original: WorldTime.style.visibility='visible' //'hidden' WorldTime.style.position='relative' //'absolute' change to: WorldTime.style.visibility='hidden' //'visible' WorldTime.style.position='absolute' //'relative' You must know the word after // is only comments in JS:) 示例二: 中华网实时滚动新闻 代码:--------------------------------------------------------------------------------HTML QuickLaunch /// China News by Lee1892 java script:window.location.replace("file:///x:/.../ChinaNews/index.html") You can change the news you want to show at line 41 original: <script language="JavaScript" src="http://app0.china.com/freecode/out.php?typeid =945&num=20&t=否"></script> The number after 'typeid' indicate the news' catalog (see table below) 264 文化传真页面 1055 教育新闻页面 420 股市动态页面 567 财经要闻 205 影视焦点页面 764 医药快讯页面 777 两性话题页面 25 军事评论页面 64 军事要闻页面 167535 撞机页面 945 中国新闻页面 1007 社会新闻页面 1000 国际新闻页面 1024 要闻提示页面 1040 国内足球新闻页面 1221 NBA新闻页面 1066 世界网球新闻页面 1047 国际足球新闻页面 154 科技新闻页面 156 互联网络新闻页面 896 通信聚焦新闻页面 You should also check page http://app0.china.com/freecode/freenews.php to see the latest infomation. You also change the number of news you want to show, locates at line 41 and 57 At line 41, the number after 'num', and at line 57 is the value of variable NewsItem. Change them to a same number which should be 10, 20, 30 ... 100. 示例三: 天气在线 代码:--------------------------------------------------------------------------------HTML QuickLaunch /// Weather by Lee1892 Infomations are from http://www.t7online.com/ java script:window.location.replace("file:///x:/.../Weather/index.html") You should check you local city ID from http://www.t7online.com/ first, and then change line 98 original: var MyCityURL="http://www.t7online.com/cgi-bin/citybild?PROVIDER=anwendung&WMO=58362&LANG=cn" Change number after 'WMO=' to your local city ID. 示例四: Winamp控制 代码:--------------------------------------------------------------------------------HTML QuickLaunch /// RunBox by [kmr] java script:window.location.replace("file:///x:/...//HTMLql/AmpBar/index.html") A winamp control. You need the WinampCOM plugin (http://www.adcock8.freeserve.co.uk) for the page to work properly. Double-click the window to activate/desactivate the auto song info update.-------------------------------------------------------------------------------- 这个呢就不是我自己做的乐,他给出的WinampCOM主页也换到http://mysite.freeserve.com/johnadcock了,不过应该是不支持3.0的,呵呵 示例五: RunBox,即在栏内键入命令即可运行,等同于Run对话框的功能 代码:--------------------------------------------------------------------------------<html> <head> <title>Run Box</title> <style> body { border-width: 0; background-color: buttonface; color: black; font-family: verdana; font-size: 9px; margin: 3,0,0,0 } </style> <script language="JavaScript"> function Open(appName) { //var appName="explorer /root,,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"; var WshShell = new ActiveXObject("WScript.Shell"); WshShell.Run(appName,1); window.blur(); } </script> </head> <body scroll="no"> <form onsubmit="Open(document.all.T1.value)"> <p><input type="text" name="T1" size="10" height="5"></p> </form> </body> </html>-------------------------------------------------------------------------------- 其实,windows自带的Address那个Toolbar就可以,之所以给出此例是想说明如何用HTML启动程序,呵呵 最后的几句话: 我想说的是我做的几个示例都还是很不成熟的,只是给大家一些想法。 我们知道HTML加上VBS和JS是十分强大的(比如对于Windows Messenger,有MAPI,不知道VBS能调用不?),还有花哨的Flash,您甚至可以把flash放到自己做的Sidebar里(比如一个好玩的小游戏,这样就成了一个真正的桌面游戏了)。 还有很多很多可以做的东西,您一定有更多的想法或更好的实现方法。请来参加讨论吧,哪怕只是一些设想(或许有高手知道如何实现呢)。 我只是一个抛砖的人 -------------------------------------------------------------------------------- 以上内容由lnboy整理收藏,原帖在http://bbs.et8.net/bbs/

继续阅读《Windows任务栏上显示网页的超酷玩法!!!!!!!!!!!》的全文内容...



--------------------------
新闻:鲍尔默:不解Google为何推出两款操作系统
网站导航: 博客园首页  新闻  .NET频道  社区  博问  闪存  找找看
posted on 2009-07-15 10:28 delphi2007 阅读(523) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。