该程序是我从别人的网站上分析出来的!由于对方的网站使用了框架,而且又取消了鼠标的右键功能,因此费了好长时间!
当你浏览该页时,工具条始终浮在左上角,你若不喜欢,可以自己调节摆放位置!若想多页使用该代码,可以把jsp程序部分写成js的文件,然后再通过调用来实现,有不明白的地方,欢迎各位与我交流!
演示地址:http://www.85time.com/softuse/bar.htm
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<style type="text/css">
.wdblack{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
.wdgray{ font-size:9pt; line-height:11pt; font-family:宋体; color:#cccccc }
.wdblue{ font-size:9pt; line-height:11pt; font-family:宋体; color:#2f8bdf }
.wdred{ font-size:9pt; line-height:11pt; font-family:宋体; color:red }
.wdwhite{ font-size:9pt; line-height:11pt; font-family:宋体; color:white }
.moveme{cursor: move;}
.handle{cursor: move;}
.coolbar{background: #fffffc;border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; padding: 2px; font: menu;}
.coolbutton{font-size:9pt;border: 1px solid buttonface; padding: 1px; text-align: center; cursor: hand;color:#555555}
.coolbutton img {filter: gray();} div{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
text{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
input{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
table{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
body{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
form{ font-size:9pt; line-height:11pt; font-family:宋体; color:black }
a:link{ font-size:9pt; font-family:宋体; text-decoration: none; color:#2f8bdf }
a:visited{ font-size:9pt; font-family:宋体; text-decoration: none; color:#2f8bdf }
a:hover{ font-size:9pt; font-family:宋体; text-decoration: underline; color:#ff0000 }
</style>
<script language="javascript">
var dragobject = null;
var tx;
var ty;
document.onmouseover = doover;
document.onmouseout = doout;
document.onmousedown = dodown;
document.onmouseup = doup;
document.onmousedown=initdown;
document.onmouseup=initup;
document.onmousemove=initmove;
function stat(){
var a = pageyoffset;
document.bar.top = a;
settimeout('stat()',2);
}
function fix(){
nome=navigator.appname
if(nome==27.netscape') stat();
else{
var a=document.body.scrolltop;
var b=document.body.scrollleft;
bar.style.top = a;
bar.style.left = b;
}
}
function getreal(el) {
temp = el;
while ((temp != null) && (temp.tagname != "body")) {
if ((temp.classname == "moveme") (temp.classname == "handle")){
el = temp;
return el;
}
temp = temp.parentelement;
}
return el;
}
function moveme_onmousedown() {
el = getreal(window.event.srcelement)
if (el.classname == "moveme") {
dragobject = el;
ty = (window.event.clienty - dragobject.style.pixeltop);
tx = (window.event.clientx - dragobject.style.pixelleft);
window.event.returnvalue = false;
window.event.cancelbubble = true;
}else if (el.classname == "handle") {
tmp = el.getattribute("for");
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器