锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
JS鏂囦歡浠g爜濡備笅(mouse_on_title.js):
<!--
//***********榛樿璁劇疆瀹氫箟.*********************
tPopWait=50; //鍋滅暀tWait璞鍚庢樉紺烘彁紺恒?BR>tPopShow=6000; //鏄劇ずtShow璞鍚庡叧闂彁紺?BR>showPopStep=20;
popOpacity=95;
fontcolor="#000000";
bgcolor="#EDEDED";
bordercolor="#007db5";
//***************鍐呴儴鍙橀噺瀹氫箟*****************
sPop=null;curShow=null;tFadeOut=null;tFadeIn=null;tFadeWaiting=null;
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { background-color: " + bgcolor + ";color:" + fontcolor + "; border: 1px " + bordercolor + " solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");
function showPopupText(){
var o=event.srcElement;
MouseX=event.x;
MouseY=event.y;
if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
if(o.dypop!=sPop) {
sPop=o.dypop;
clearTimeout(curShow);
clearTimeout(tFadeOut);
clearTimeout(tFadeIn);
clearTimeout(tFadeWaiting);
if(sPop==null || sPop=="") {
dypopLayer.innerHTML="";
dypopLayer.style.filter="Alpha()";
dypopLayer.filters.Alpha.opacity=0;
}
else {
if(o.dyclass!=null) popStyle=o.dyclass
else popStyle="cPopText";
curShow=setTimeout("showIt()",tPopWait);
}
}
}
function showIt(){
dypopLayer.className=popStyle;
dypopLayer.innerHTML=sPop;
popWidth=dypopLayer.clientWidth;
popHeight=dypopLayer.clientHeight;
if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
else popLeftAdjust=0;
if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
else popTopAdjust=0;
dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
dypopLayer.style.filter="Alpha(Opacity=0)";
fadeOut();
}
function fadeOut(){
if(dypopLayer.filters.Alpha.opacity<popOpacity) {
dypopLayer.filters.Alpha.opacity+=showPopStep;
tFadeOut=setTimeout("fadeOut()",1);
}
else {
dypopLayer.filters.Alpha.opacity=popOpacity;
tFadeWaiting=setTimeout("fadeIn()",tPopShow);
}
}
function fadeIn(){
if(dypopLayer.filters.Alpha.opacity>0) {
dypopLayer.filters.Alpha.opacity-=1;
tFadeIn=setTimeout("fadeIn()",1);
}
}
document.onmouseover=showPopupText;
-->
搴旂敤鐨勬椂鍊?鍦ㄩ〉闈㈢殑<head></head>涔嬮棿鍔犲叆:
<SCRIPT language=javascript src="mouse_on_title.js"></SCRIPT>
鍦ㄩ渶瑕佹彁紺哄眰鐨勯摼鎺ヤ腑鍔犲叆title灞炴?姣斿:
//<a href=鈥濈洰鏍団?title=鈥濇彁紺烘枃瀛楀唴瀹光?gt;嫻嬭瘯</a>
鍏跺疄濡傛灉涓嶅姞涓婅堪JS鏂囦歡,鎻愮ず灞傛晥鏋滀篃鏄彲浠ュ嚭鏉ョ殑.灝辨槸閫熷害姣旇緝鎱?鎻愮ず灞傛晥鏋滄瘮杈冨崟璋冭屽凡.
<body bgcolor="#FFFFFF" text="#000000">
<table border="0" width="36%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="100%" valign="bottom" height="360" bgcolor="#666666">
<table width="56%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#666666">
<tr>
<td><object id="RP1" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=419 height=300>
<param name="_ExtentX" value="4657">
<param name="_ExtentY" value="3493">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="-1">
<param name="SRC" value="<%=urls%>">
<param name="CONTROLS" value="Imagewindow">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object></td>
</tr>
<tr>
<td><object id="RP2" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=420 height=30>
<param name="_ExtentX" value="4657">
<param name="_ExtentY" value="794">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="-1">
<param name="SRC" value="<%=urls%>">
<param name="CONTROLS" value="ControlPanel">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
//
<html>
<head>
<title>鏃犳爣棰樻枃妗?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table border="0" width="36%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="100%" valign="bottom" height="360" bgcolor="#666666">
<table width="56%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#666666">
<tr>
<td><object id="RP1" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=419 height=300>
<param name="_ExtentX" value="4657">
<param name="_ExtentY" value="3493">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="-1">
<param name="SRC" value="<%=urls%>">
<param name="CONTROLS" value="Imagewindow">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object></td>
</tr>
<tr>
<td><object id="RP2" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=420 height=30>
<param name="_ExtentX" value="4657">
<param name="_ExtentY" value="794">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="-1">
<param name="SRC" value=" <param name="CONTROLS" value="ControlPanel">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
response.reset();
//娓呴櫎鎺夊師鏉ラ粯璁ょ殑text/html
responset.setContentType("image/jpeg");
//閲嶈涓篿mage/jpeg
//璁劇疆欏甸潰涓嶇紦瀛?BR>response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
// 鍦ㄥ唴瀛樹(shù)腑鍒涘緩鍥捐薄
int width=60, height=20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// 鑾峰彇鍥懼艦涓婁笅鏂?BR>Graphics g = image.getGraphics();
//鐢熸垚闅忔満綾?BR>Random random = new Random();
// 璁懼畾鑳屾櫙鑹?BR>g.setColor(getRandColor(200,250));
g.fillRect(0, 0, width, height);
//璁懼畾瀛椾綋
g.setFont(new Font("Times New Roman",Font.PLAIN,18));
//鐢昏竟妗?BR>//g.setColor(new Color());
//g.drawRect(0,0,width-1,height-1);
// 闅忔満浜х敓155鏉″共鎵扮嚎錛屼嬌鍥捐薄涓殑璁よ瘉鐮佷笉鏄撹鍏跺畠紼嬪簭鎺㈡祴鍒?BR>g.setColor(getRandColor(160,200));
for (int i=0;i<155;i++)
{
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x,y,x+xl,y+yl);
}
// 鍙栭殢鏈轟駭鐢熺殑璁よ瘉鐮?4浣嶆暟瀛?
String sRand="";
for (int i=0;i<4;i++){
String rand=String.valueOf(random.nextInt(10));
sRand+=rand;
// 灝嗚璇佺爜鏄劇ず鍒板浘璞′腑
g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));//璋冪敤鍑芥暟鍑烘潵鐨勯鑹茬浉鍚岋紝鍙兘鏄洜涓虹瀛愬お鎺ヨ繎錛屾墍浠ュ彧鑳界洿鎺ョ敓鎴?BR>g.drawString(rand,13*i+6,16);
}
// 灝嗚璇佺爜瀛樺叆SESSION
session.setAttribute("rand",sRand);
// 鍥捐薄鐢熸晥
g.dispose();
// 杈撳嚭鍥捐薄鍒伴〉闈?BR>ImageIO.write(image, "JPEG", response.getOutputStream());
%>
---------------浣跨敤楠岃瘉鐮佸浘鐗囩殑鏂囦歡---------a.jsp------------------------------------
<%@ page contentType="text/html;charset=gb2312" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>璁よ瘉鐮佽緭鍏ラ〉闈?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</head>
<body>
<form method=post action="check.jsp">
<table>
<tr>
<td align=left>緋葷粺浜х敓鐨勮璇佺爜錛?lt;/td>
<td><img border=0 src="image.jsp"></td>
</tr>
<tr>
<td align=left>杈撳叆涓婇潰鐨勮璇佺爜錛?lt;/td>
<td><input type=text name=rand maxlength=4 value=""></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="鎻愪氦媯(gè)嫻?></td>
</tr>
</form>
</body>
</html>
-----------------楠岃瘉鐨勯〉闈?---------check.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>璁よ瘉鐮侀獙璇侀〉闈?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</head>
<body>
<%
String rand = (String)session.getAttribute("rand");
String input = request.getParameter("rand");
%>
緋葷粺浜х敓鐨勮璇佺爜涓猴細(xì) <%= rand %><br>
鎮(zhèn)ㄨ緭鍏ョ殑璁よ瘉鐮佷負(fù)錛?<%= input %><br>
<br>
<%
if (rand.equals(input)) {
%>
<font color=green>杈撳叆鐩稿悓錛岃璇佹垚鍔燂紒</font>
<%
} else {
%>
<font color=red>杈撳叆涓嶅悓錛岃璇佸け璐ワ紒</font>
<%
}
%>
</body>
</html>
if (ie4) {
if (navigator.userAgent.indexOf('MSIE 5')>0) {
ie5 = true;
} else {
ie5 = false; }
} else {
ie5 = false;
}
var x = 0;
var y = 0;
var para = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
var tr=1;
if ( (ns4) || (ie4) ) {
if (ns4) over = document.overDiv
if (ie4) over = overDiv.style
document.onmousemove = mouseMove
if (ns4) document.captureEvents(Event.MOUSEMOVE)
}
function hide() {
if ( cnt >= 1 ) { sw = 0 };
if ( (ns4) || (ie4) ) {
if ( sw == 0 ) {
para = 0;
hideObject(over);
} else {
cnt++;
}
}
}
function show(txt) {
layerWrite(txt);
disp();
}
function layerWrite(txt) {
if (ns4) {
var lyr = document.overDiv.document
lyr.write(txt)
lyr.close()
}
else if (ie4) document.all["overDiv"].innerHTML = txt
if (tr) { }
}
function disp() {
if ( (ns4) || (ie4) ) {
if (para == 0) {// Right
moveTo(over,x+offsetx,y+offsety);
}
showObject(over);
para = 1;
}
}
function mouseMove(e) {
if (ns4) {x=e.pageX; y=e.pageY;}
if (ie4) {x=event.x; y=event.y;}
if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
if (para) {
moveTo(over,x+offsetx,y+offsety);
}
}
function cClick() {
hideObject(over);
sw=0;
}
// Make an object visible
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}
// Hides an object
function hideObject(obj) {
if (ns4) obj.visibility = "hide"
else if (ie4) obj.visibility = "hidden"
}
// Move a layer
function moveTo(obj,xL,yL) {
obj.left = xL
obj.top = yL
}
鍙﹀,鍦ㄨ鏄劇ず鐨勯〉闈腑閫傚綋浣嶇疆娣誨姞:
<DIV id=overDiv style="POSITION: absolute; Z-INDEX: 1"></DIV>
<SCRIPT language=javascript src="xxx.js"></SCRIPT>
紺轟緥鍦板潃:http://www.xmeteo.xm.fj.cn/fjcity.asp