锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
聽聽聽 pageEncoding="gb2312"%>
<%@ page import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*"%>
<%!
聽聽 Color getRandColor(int fc,int bc){
聽Random rand=new Random();
聽if(fc>255) fc=255;
聽if(bc>255) bc=255;
聽int r=fc+rand.nextInt(bc-fc);
聽int g=fc+rand.nextInt(bc-fc);
聽int b=fc+rand.nextInt(bc-fc);
聽return new Color(r,g,b);
}
%>
<%
聽 //璁劇疆欏甸潰涓嶇紦瀛?br />聽 response.setHeader("Pragma","No-cache");
聽 response.setHeader("Cache-Control","no-cache");
聽 response.setDateHeader("Expires",0);
聽
聽 //鍦ㄥ唴瀛樹腑鍒涘緩鍥懼儚
聽 int width=60,height=20;
聽 BufferedImage image=new BufferedImage(width,height,BufferedImage.TYPE_INT_BGR);
聽
聽 //鑾峰彇鍥懼儚
聽 Graphics g=image.getGraphics();
聽 //鐢熸垚闅忔満綾?br />聽 Random rand=new Random();
聽 //璁懼畾鑳屾櫙棰滆壊
聽 g.setColor(getRandColor(200,250));
聽 g.fillRect(0,0,width,height);
聽 //璁懼畾瀛椾綋
聽 g.setFont(new Font("Times New Roman",Font.PLAIN,18));
//闅忔満浜х敓155鏉″共鎵扮嚎錛屼嬌鍥捐薄涓殑璁よ瘉鐮佷笉鏄撹鍏跺畠紼嬪簭鎺㈡祴鍒?br />聽g.setColor(getRandColor(160,200));
聽for(int i=0;i<155;i++){
聽 int x=rand.nextInt(width);
聽 int y=rand.nextInt(height);
聽 int x1=rand.nextInt(12);
聽 int y1=rand.nextInt(12);
聽 g.drawLine(x,y,x+x1,y+y1);
聽
聽}
聽//鍙栭殢鏈轟駭鐢熺殑4浣嶉獙璇佺爜
聽String sRand="";
聽for(int i=0;i<4;i++){
聽 String strRand=String.valueOf(rand.nextInt(10));
聽 sRand+=strRand;
聽 //灝嗛獙璇佺爜鏄劇ず鍒板浘鍍忎腑
聽 g.setColor(new Color(20+rand.nextInt(110),20+rand.nextInt(110),20+rand.nextInt(110)));
聽 g.drawString(strRand,13*i+6,16);
聽}
聽//灝嗛獙璇佺爜鏀懼叆session
聽 session.setAttribute("rand",sRand);
聽
聽g.dispose();
//杈撳嚭鍥捐薄鍒伴〉闈?br />聽ImageIO.write(image, "JPEG", response.getOutputStream());
聽
%>
}
rs.close();
rs=null;
%>
onecount=<%=count%>;
function changelocation(locationid){
document.myform.smalllocation.length=0;
var locationid=locationid;
var i;
document.myform.smalllocation.options[0]=new Option('==鎵閫夊煄甯傜殑鍦板尯==','');
for(i=0;i<onecount;i++){
if (subcat[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
聽聽
}
</script>
<%
聽sql="select * from village order by districtid asc";
聽rs2=stmt.executeQuery(sql);
%>
<script language="javascript">
var onecount2;
onecount2=0;
subcat2=new Array();
<%
count2=0;
while(rs2.next()){
聽%>
聽subcat2[<%=count2%>]=new Array("<%=rs2.getString("villagename")%>","<%=rs2.getInt("districtid")%>","<%=rs2.getInt("villageid")%>");
聽<%
聽count2 = count2 + 1 ;
}
rs2.close();
rs2=null;
%>
onecount2=<%=count2%>;
function changelocation2(districtid)
{
document.myform.village.length = 0;
var districtid=districtid;
var j;
document.myform.village.options[0] = new Option('==鎵閫夊湴鍖虹殑鍘垮尯==','');
for (j=0;j < onecount2; j++)
{
聽 if (subcat2[j][1] == districtid)
聽{
聽 document.myform.village.options[document.myform.village.length] = new Option(subcat2[j][0], subcat2[j][2]);
聽 }
}
}
</script>
</head>
<body>
<form name="myform" method="post">
鍒嗙被錛?lt;select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)" size="1">
<option selected>璇烽夋嫨浣犳墍鍦ㄧ殑鐪佷喚</option>
<%
聽 sql ="select * from province order by locationname asc";
聽rs1 = stmt.executeQuery(sql);
聽while(rs1.next()){
聽%>
聽<option value="<%=rs1.getInt("locationid")%>"><%=rs1.getString("locationname")%></option>
聽<% }
聽
聽
聽rs1.close();
聽rs1 = null;
聽conn.close();
聽conn =null;
%>
</select><select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].value)">
<option selected value="">==鎵鏈夊湴鍖?=</option>
</select><select name="village" size="1">
<option selected>==鎵鏈夊幙鍖?=</option>
</select>
</form>
</body>
</html>