火车上,一个女孩靠在男孩肩膀上睡着了,这是一个故事;一个男孩靠在女孩肩膀上睡着了,这是一个事故;我就纳了闷,为什么我的生活中处处充斥着事故而不是故事!(

项目名称:**全球旅游电子商务平台
人员技能要求:
Struts:     1年以上
Hibernate:  1年以上
JAVA开发:  3年以上
Oracle:     2年以上
Eclipse:    1年以上
下面是有则更好:
Spring、AJAX、CVS、JMS、JSF。
薪水待遇:5000~7000人民币   项目周期:6个月
工作地点:北京  面试时间:11月28日~12月1日
---------------------------------------
合适的请联系(不符合者勿扰)不在群里聊.单独找我
问题询问QQ号码:   267025822
电话:    010-58608128-1007 联系人:赵先生
邮箱:    qianyan@hws.com.cn                    
(请先发送简历,我们会尽快和您取得联系)  

先帝虑汉、贼不两立,王业不偏安,故托臣以讨贼也。以先帝之明,量臣之才,固知臣伐贼才弱敌强也。然不伐贼,王业亦亡,惟坐而待亡,孰与伐之?是故托臣而弗疑也。臣受命之日,寝不安席,食不甘味,思惟北征,宜先入南,故五月渡泸,深入不毛,并日而食。臣非不自惜也,顾王业不可偏安於蜀都,故冒危难以奉先帝之遗意。而议者谓为非计。今贼适疲於西,又务於东。兵法乘劳,此进趋之时也。谨陈其事如左:
Hps4jHi.Bkq5w纯真时空论坛 bbs.cz88.net
p0Ky/LEP4C2M"GFX
   高帝明并日月,谋臣渊深;人然陟险被创,危然後安。今陛下未及高帝,谋臣不如良、平;而欲以长策取胜,坐定天下。此臣之未解一也。刘繇、王朗各据州郡,论安言计,动引圣人;群疑满腹,众难塞胸;今岁不战,明年不征;使孙策坐大,遂并江东,此臣之未解二也。曹操智计,殊绝於人,其用兵也,拂孙吴;然困於南阳,险於乌巢,危於祁连,逼於黎阳,几败北山,殆死潼关,然後伪定一时尔。况臣才弱,而欲以不危而定之,此臣之未解三也。曹操五攻昌霸不下,四越巢湖不成;任用李服而李服图之;策任夏侯而夏侯败亡。先帝每称操为能,犹有此失,况臣驽下,何能必胜?此臣之未解四也。自臣到汉中,中间年耳;然丧赵云、阳群、马玉、阎芝、丁立、白寿、刘郃、邓铜等及曲长、屯将七十馀人,突将无前,叟,青羌、散骑武骑一千馀人:此皆数十年之内所纠合四方之精锐,非一州之所有;若复数年,则损三分之二也,当何以图敌?此臣之未解五也。今民穷兵疲,而事不可息;事不可息,则住与行,劳费正等;而不及早图之,欲以一州之地,与贼持久。此臣之未解六也。纯真时空论坛|3WOV8lMje
 纯真,QQ,时尚,悠闲,IPb9ZH2_*K^#WX*B
   夫难平者,事也。昔先帝败军於楚,当此时,曹操拊手,谓天下已定。然後先帝东连吴、越,西取巴、蜀,举兵北征,夏侯授首,此操之失计而汉事将成也。然後吴更违盟,关羽毁败,秭归蹉跌,曹丕称帝。凡事如是,难可逆料。臣鞠躬尽瘁,死而後已,至於成败利钝,非臣之明所能逆睹也。

      有些事情干嘛要说出来呢,本来是那样的你就不能不换个方式方法说ma>为何要这样说,伤我的至尊,但是,我会嘱咒你的,哈哈,没准你丫的是我第二,我也很爱说出来的而且很直白的那种,嘻嘻,我考。

          没有亲自去看招聘会,但听同学说很多人,岗位&人数比例为2%,呵呵,可能由于:
1.刚开始,去看看的人多。
2.历来都是僧多粥少。
3.就业历来都很火爆。

       本人现在很忙,没有办法升级论坛和del调那个垃圾信息,也没有时间去找论坛版主来管理,但是等我考完研后可能会大刀阔斧的改变这一现状!
    再就是本站的访问量慢慢上升,可能会打一点小广告,等等。还有就是要定一个方向,可能就不会这么富含有个性了,呵呵,还望大家尽量,嘻嘻◎
                                                      站长:向东   #Email:xdy108@126.com

                                                                          2006-11-25

[p align=center]*************************************
本贴从网上搜索得来,是我初学jsp找到的最好的一篇配置指南了。原作者已无法确定,不过在此也略表感谢。当初,我遍历tomcat英文文档依然无法找到servlet的安装配置的方法(本人e文水平有限),后来看到这贴子一时豁然开朗。值得推介。
*************************************

j2sdk1.5下载地址:http://java.sun.com
tomcat5.5下载地址:http://jakarta.apache.org/site/binindex.cgi
j2sdk1.5安装目录:c:\j2sdk1.5.0
tomcat5.5安装目录:c:\tomcat

一.配置j2sdk1.5.0
1.windows 2000 server系列下配置
我的电脑->属性->高级->环境变量
追加变量名:java_home 变量值:c:\j2sdk1.5.0
追加变量名:path下变量值:%java_home%\bin;
追加变量名:classpath下变量值:.;%java_home%\lib;或.;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar
*注:“.;”代表当前目录下的所有引用,“%...%”变量宏替换。

2.windows 9x系列下配置
用记事本编辑autoexec.bat,加入下列语句:
set java_home=c:\j2sdk1.5.0;
set path=%path%;%java_home%\bin;
set classpath=.;%java_home%\lib;或.;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar

3.windows xp、2003 server 下配置
以上两种方法皆可

4.运行

a.用记事本编辑以下代码,并保存为helloworld.java:
public class helloworld{
public static void main(string[] args){
system.out.println("hello,world!");
}
}

b.开始->运行->cmd
在控制台中切换到当前目录:
javac helloworld.java
java helloworld
你就会在控制台上看见输出的hello,world!

*注:javac是编译命令,它把helloworld.java编译成helloworld.class
  java就是解释命令,jvm把helloworld.class解释执行
至此java运行环境配置、调试完成。

二.配置tomcat5.5
1.windows 2000 server系列下配置
我的电脑->属性->高级->环境变量
追加变量名:tomcat_home 变量值:c:\tomcat
追加变量名:classpath下变量值:%tomcat_home%\common\lib;

2.windows 9x系列下配置
用记事本编辑autoexec.bat,加入下列语句:
set tomcat_home=c:\tomcat;
set classpath=%classpath%;%tomcat_home%\common\lib;

3.windows xp、2003 server 下配置
以上两种方法皆可

4.运行
  在控制台中转到c:\tomcat\bin这个目录,运行startup.bat,然后会出现一个窗口,连跳一大串东西,最后表示server已经运行:
“server startup in ... ms”
打开ie浏览器并在地址栏中输入:http://localhost:8080
此时出现欢迎界面表示tomcat已经ok!
  在控制台中转到c:\tomcat\bin这个目录,运行shutdown.bat,关闭服务器。
至此tomcat运行环境配置、调试完成。

三.配置javabeans

1.用记事本编辑以下代码,并保存为circle.java:
package abc.def;
import java.io.*;
public class circle{
int radius;
public circle(){
radius=1;
}
public int getradius(){
return radius;
}
public void setradius(int newradius){
radius=newradius;
}
public double circlearea(){
return math.pi*radius*radius;
}
public double circlelength(){
return 2.0*math.pi*radius;
}
}

2.将circle.java保存在c:\tomcat\common\classes\abc\def目录下。

3.开始->运行->cmd
在控制台中切换到当前目录:
javac circle.java或直接输入javac c:\tomcat\common\classes\abc\def\circle.java

4.用记事本编辑以下代码,并保存为usebeans.jsp:
<%@ page contenttype="text/html;charset=gb2312" %>
<%@ page import="abc.def.circle" %>





<% girl.setradius(100);
%>

圆的半径是:
<%= girl.getradius() %>

圆的周长是:
<%= girl.circlelength() %>

圆的面积是:
<%= girl.circlearea() %>




5.将usebeans.jsp保存在c:\tomcat\webapps\root目录下。

6.启动服务器后,打开ie浏览器并在地址栏中输入:http://localhost:8080/usebeans.jsp
如出现预期值,表示javabeans配置成功!

圆的半径是: 100

圆的周长是: 628.3185307179587

圆的面积是: 31415.926535897932

至此javabeans运行环境配置、调试完成。

四.servlet配置
1.windows 2000 server系列下配置
我的电脑->属性->高级->环境变量
追加变量名:classpath下变量值:%tomcat_home%\common\lib\servlet-api.jar;

2.windows 9x系列下配置
用记事本编辑autoexec.bat,加入下列语句:
set classpath=%classpath%;%tomcat_home%\common\lib\servlet-api.jar;

3.windows xp、2003 server 下配置
以上两种方法皆可

4.运行
a.用记事本编辑以下代码,并保存为hello.java:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class hello extends httpservlet{
public void init(servletconfig config) throws servletexception{
super.init(config);
}
public void service(httpservletrequest request,httpservletresponse response) throws ioexception{
printwriter out=response.getwriter();
response.setcontenttype("text/html;charset=gb2312");
out.println("");
out.println("hello!");
out.println("");
}
}

b.将hello.java保存在c:\tomcat\common\classes目录下。

c.开始->运行->cmd
在控制台中切换到当前目录:
javac hello.java或直接输入javac c:\tomcat\common\classes\hello.java

d.注册servlet
用记事本打开c:\tomcat\webapps\root\web-inf\web.xml

-
welcome to tomcat
welcome to tomcat
-
.
.
.
-

之间相应位置追加以下两组数据:

hello
hello



hello
/servlet/hello


*注:...为servlet在服务器中的id
...为servlet-class类名
...为镜像路径亦虚拟路径
c:\tomcat\common\classes为类共享目录,亦可在:
c:\tomcat\webapps\你的应用目录\web-inf\web.xml
中注册,不过在应用servlet时须加入c:\tomcat\webapps\下的目录名,如:
http://localhost:8080/你的应用目录/servlet/hello
建议你自己应用所用的servlet类放置到 c:\tomcat\webapps\你的应用目录\web-inf\classes 中;在web.xml注册servlet类路径也是“/hello”即可。

e.重新启动服务器后,打开ie浏览器并在地址栏中输入:http://localhost:8080/servlet/hello
显示:“hello!”,则配置成功!
至此servlet运行环境配置、调试完成。

以上为j2sdk1.5.0+tomcat5.5(04.07.21)配置环境步骤。由于tomcat版本更新极快,所以各版本配置略有差异。希望大家能够灵活变通!

这里强调本版本几个注意事项:
1.javabeans强制引入包package *.*;
2.servlet类库为%tomcat_home%\common\lib\servlet-api.jar
而不是%tomcat_home%\lib\servlet.jar(不存在这个目录及类库)
3.引入第三方类库须加入classpath或加入%java_home%\lib\下,以正常加载。用tomcat5.5(04.07.21)引用该类库时须将该*.jar文件加入%tomcat_home%\common\lib\下。

本帖只作参考,jsp配置环境有许多组合,这里只提及j2sdk1.5.0+tomcat5.5,但足已供初、中级开发人员使用!帖中不足之处请大家不吝赐教,不盛感激!

[/p]

Servlet以及它的优越性  
  Servlet是用Java编写的Server端程序,它与协议和平台无关。Servlet运行于Java-enabled Web Server中。Java Servlet可以动态地扩展Server的能力,并采用请求-响应模式提供Web服务。
  最早支持Servlet技术的是JavaSoft的Java Web Server。此后,一些其它的基于Java的Web Server开始支持标准的Servlet API。Servlet的主要功能在于交互式地浏览和修改数据,生成动态Web内容。这个过程为:
  客户端发送请求至服务器端;
  服务器将请求信息发送至Servlet
  Servlet生成响应内容并将其传给Server。响应内容动态生成,通常取决于客户端的请求
  服务器将响应返回给客户端
  Servlet看起来像是通常的Java程序。Servlet导入特定的属于Java Servlet API的包。因为是对象字节码,可动态地从网络加载,可以说Servlet对Server就如同Applet对Client一样,但是,由于Servlet运行于Server中,它们并不需要一个图形用户界面。从这个角度讲,Servlet也被称为Faceless Object。
  JAVA Servlet的优势:
  Servlet可以和其他资源(文件、数据库、Applet、Java应用程序等)交互,以生成返回给客户端的响应内容。如果需要,还可以保存请求-响应过程中的信息。
  采用Servlet,服务器可以完全授权对本地资源的访问(如数据库),并且Servlet自身将会控制外部用户的访问数量及访问性质
  Servlet可以是其它服务的客户端程序,例如,它们可以用于分布式的应用系统中,可以从本地硬盘,或者通过网络从远端硬盘激活Servlet。
  Servlet可被链接(chain)。一个Servlet可以调用另一个或一系列Servlet,即成为它的客户端。
  采用Servlet Tag技术,可以在HTML页面中动态调用Servlet。
  Servlet API与协议无关。它并不对传递它的协议有任何假设。
  像所有的Java程序一样,Servlet拥有面向对象Java语言的所有优势
  Servlet提供了Java应用程序的所有优势——可移植、稳健、易开发。使用Servlet 的Tag技术,Servlet能够生成嵌于静态HTML页面中的动态内容。
  一个Servlet被客户端发送的第一个请求激活,然后它将继续运行于后台,等待以后的请求。每个请求将生成一个新的线程,而不是一个完整的进程。多个客户能够在同一个进程中同时得到服务。一般来说,Servlet进程只是在Web Server卸载时被卸载。
  Servlet生命周期:
  装载Servlet。这项操作一般是动态执行的。然而,Server通常会提供一个管理的选项,用于在Server启动时强制装载和初始化特定的Servlet。
  Server创建一个Servlet的实例
  Server调用Servlet的init()方法
  一个客户端的请求到达Server
  Server创建一个请求对象
  Server创建一个响应对象
  Server激活Servlet的service()方法,传递请求和响应对象作为参数
  service()方法获得关于请求对象的信息,处理请求,访问其他资源,获得需要的信息
  service()方法使用响应对象的方法,将响应传回Server,最终到达客户端。service()方法可能激活其它方法以处理请求,如doGet()或doPost()或程序员自己开发的新的方法
  对于更多的客户端请求,Server创建新的请求和响应对象,仍然激活此Servlet的service()方法,将这两个对象作为参数传递给它。如此重复以上的循环,但无需再次调用init()方法。一般Servlet只初始化一次 ,当Server不再需要Servlet时(一般当Server关闭时),Server调用Servlet的Destroy()方法。
  在美国,EJB+Servlet+JSP几乎成为电子商务的开发标准。本来 ASP 也很有希望,但微软最近可能把精力都集中在打官司和Win2000上, 因此电子商务发展得太少。PHP由于其模式和一些天生缺陷,毫无希望。 在美国,很少有商业站点用PHP的。  

James Gosling上周参加了纽约的Sun 全球教育研讨会(World Wide Education & Research Conference),在会上这位Java 之父进行了演讲,并就提问进行了回答。
  有些人问道当前Java 所面临的威胁时,Gosling给予了这样的回答,“PHP 和Ruby 是非常好的系统,但是它们作为脚本语言来发挥力量,只局限于网页这一领域内。”

  当Gosling谈到Microsoft 的C# 时,“曾经一度我们很担心他们会做出创造性的东西——现在看他们要专注于一个平台是希望渺茫。”

  “PHP 能够简化产品因为它是100%瞄准网页的,”然而对于Java,他说,“我们拥有平衡的艺术——简化与力量的双赢。”

  最后James Gosling 说:“任何关于Java 相对PHP、Ruby还是其他语言的讨论都是没有意义的,我们同样在使用其他语言,你可以应用PHP 或者Python,以及其他语言与Java一起工作。许多人这样做。”

<HTML>
<HEAD>
<TITLE>俄罗斯方块</TITLE>
<style>
body {margin:0;background:black;}
td {height:20;width:20;}
#block_div {position:absolute;z-index:1;width:80;}
#table_div {position:absolute;z-index:0;width:320;}
#nblock_div {position:absolute;z-index:2;font:48 system;color:red;}
#title_div {position:absolute;left:326;top:7;font-size:22px;color:white}
#infobar_div {position:absolute;left:396;top:416;}
#infobar2_div {position:absolute;left:396;top:480;font-size:14px;color:white}
#infobar2_div a{color:99ccff;font:system;text-decoration:none}
</style>

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
if (document.all){
var n_width = 800;
var n_height = 600;
var n_left = Math.round( screen.width/2 ) - n_width/2;
var n_top = Math.round( screen.height/2 ) - n_height/2;
var n_IncStep = 20;
var curBlcok,nextBlock;
var arr_curBlock = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
var curX,curY;
var speed=1;
var maxspeed=9;
var clr_per_line=18;
var pause=0;
var gameover=0;
var colors = new Array("#999999","#0000FF","#80FFFF","#80FF80","#FFFF00","#FF8000","#FF00FF","#FF0000"
);
var cid;
var ncid;
var blocks = new Array("tt_O1","tt_T2","tt_Z1","tt_S1","tt_L1","tt_J1","tt_I2");
var bid;
var killedlines=0;

var tt_O1 = new Array(0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0);
var tt_O2 = new Array(0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0);
var tt_O3 = new Array(0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0);
var tt_O4 = new Array(0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0);

var tt_T1 = new Array(0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,0);
var tt_T2 = new Array(0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,0);
var tt_T3 = new Array(0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0);
var tt_T4 = new Array(0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,0);

var tt_Z1 = new Array(0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0);
var tt_Z2 = new Array(0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0);
var tt_Z3 = new Array(0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0);
var tt_Z4 = new Array(0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0);

var tt_S1 = new Array(0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0);
var tt_S2 = new Array(0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0);
var tt_S3 = new Array(0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0);
var tt_S4 = new Array(0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0);

var tt_L1 = new Array(0,1,0,0,0,1,0,0,0,1,1,0,0,0,0,0);
var tt_L2 = new Array(0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0);
var tt_L3 = new Array(0,0,0,0,0,1,1,0,0,0,1,0,0,0,1,0);
var tt_L4 = new Array(0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0);

var tt_J1 = new Array(0,0,1,0,0,0,1,0,0,1,1,0,0,0,0,0);
var tt_J2 = new Array(0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0);
var tt_J3 = new Array(0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0);
var tt_J4 = new Array(0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,0);

var tt_I1 = new Array(0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0);
var tt_I2 = new Array(0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1);
var tt_I3 = new Array(0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0);
var tt_I4 = new Array(0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1);

var table = new Array(
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
       1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)

}
else
alert("You need IE4+ to play Tetris!")

function dimension2(row,col,num){
   var i = row * num + col;
   return (this[i]);
}
Array.prototype.getd = dimension2;

function ShowBlock(x,y,block_type,color){
   for (var i=0;i<block_tbl.rows.length;i++){
       for (var j=0;j<block_tbl.rows(i).cells.length;j++){        
           var d2 = i * 4 + j;
           if (block_type[d2]==1){
               block_tbl.rows(i).cells(j).style.background = color;
           }
           else{
               block_tbl.rows(i).cells(j).style.background = "";
           }
       }
   }
   block_div.style.pixelLeft=x;
   block_div.style.pixelTop=y;
}

function ShowBlock1(x,y,block_type,color,obj_tabID,obj_divID){
   for (var i=0;i<obj_tabID.rows.length;i++){
       for (var j=0;j<obj_tabID.rows(i).cells.length;j++){        
           var d2 = i * 4 + j;
           if (block_type[d2]==1){
               obj_tabID.rows(i).cells(j).style.background = color;
           }
           else{
               obj_tabID.rows(i).cells(j).style.background = "";
           }
       }
   }
   obj_divID.style.pixelLeft=x;
   obj_divID.style.pixelTop=y;
}

function Change(inc){
   var type = curBlock.substr(0,4);
   var num = curBlock.substr(curBlock.length-1);
   num = parseInt(num) + inc;
   if (num>4&#124;&#124;num<1) num -= 4*inc;
   type += num;
   eval("arr_tmp = " + type + ";");
   if (CanMove(curX,curY,arr_tmp)){
       curBlock = type;
       eval("arr_curBlock = " + curBlock + ";");
       eval("ShowBlock(block_div.style.pixelLeft,block_div.style.pixelTop," + curBlock + ",colors[" + cid + "]);");
   }
}

function CanMove(x,y,block){
   for (i=0;i<4;i++){
       for (j=0;j<4;j++){
           if (block.getd(i,j,4)&table.getd(y/n_IncStep+i,x/n_IncStep+j,16)) return false;
       }
   }
   return true;
}

function NewBlock(){
   curBlock = nextBlock;
   cid = ncid;
   bid = Math.round(Math.random()*(blocks.length-1));
   ncid = Math.round(Math.random()*(colors.length-1));
   nextBlock = blocks[bid];
   eval("arr_curBlock = " + curBlock + ";");
   eval("ShowBlock(120,0," + curBlock + ",colors[" + cid + "]);");
   eval("arr_curBlock = " + curBlock + ";");
   eval("ShowBlock1(466,116," + nextBlock + ",colors[" + ncid + "],nblock_tbl,nblock_div);");
}

function SaveBlock(){
   for (i=0;i<4;i++){
       for (j=0;j<4;j++){
           table[(curY/n_IncStep+i)*16+curX/n_IncStep+j]&#124;=arr_curBlock[i*4+j];
           if (arr_curBlock[i*4+j]==1)
               if ((curY/n_IncStep+i<21)&&(curX/n_IncStep+j>1)&&(curX/n_IncStep+j<14))
                   table_tbl.rows(curY/n_IncStep+i).cells(curX/n_IncStep+j).style.background = colors[cid];
           if (table[(curY/n_IncStep+i)*16+curX/n_IncStep+j]!=1)
                   table_tbl.rows(curY/n_IncStep+i).cells(curX/n_IncStep+j).style.background = "black";
       }
   }
}

function DelLine(line){
   for(i=line;i>0;i--){
       for(j=2;j<14;j++){
           table[i*16+j]=table[(i-1)*16+j];
       }
   }
   table_tbl.deleteRow(line);
   table_tbl.insertRow(0);
   for (i=0;i<16;i++){
       table_tbl.rows(0).insertCell();
       if (i<2&#124;&#124;i>13) table_tbl.rows(0).cells(i).style.background="navy";        
   }
   killedlines++;
   cll.innerText=parseInt(cll.innerText)+1;
}

function DelLines(){
   var c,d,i,j;
   d=0;
   curY=block_div.style.pixelTop;
   for(i=(curY/20+3);i>curY/20-1;i--){
       c=0;
       for(j=2;j<14;j++){
           if (isNaN(table[i*16+j])&#124;&#124;i==21) break;
           c+=table[i*16+j];
       }
       if(c==12){
           DelLine(i);
           i++;
           d++;
       }
   }
   if (d>0)
       sco.innerText=parseInt(sco.innerText)+d*d*36;
}

function Lucifer(){
   for(var i=2;i<14;i++){
       if (table[16+i]==1) return true;
   }
   return false;
}

function GameOver(){
   gameover=1;
   clearInterval(gameInterval);
   block_div.innerHTML="";
   for (i=0;i<21;i++){
       for (j=2;j<14;j++){
           setTimeout("table_tbl.rows(" + i + ").cells(" + j + ").style.background = colors[Math.round(Math.random()*7)];",16*i*j);
       }
   }
   nblock_div.innerHTML = "Game Over";
}



function document_onkeydown() {
   if (gameover==1) return;
   with (block_div.style){
   curX = pixelLeft;
   curY = pixelTop;
   switch (event.keyCode){
       case 37:
           if (CanMove(curX-n_IncStep,curY,arr_curBlock))
               pixelLeft-=n_IncStep;
           break;
       case 38:
           Change(1);
           break;
       case 39:
           if (CanMove(curX+n_IncStep,curY,arr_curBlock))
               pixelLeft+=n_IncStep;
           break;
       case 40:
           if (CanMove(curX,curY+n_IncStep,arr_curBlock)){
               pixelTop+=n_IncStep;
           }
           else{
               SaveBlock();
               DelLines();
               if (Lucifer()){
                   GameOver();
                   return;
               }
               sco.innerText=parseInt(sco.innerText)+2;
               NewBlock();
           }
           break;
       case 32:
           if (pause==0){
               clearInterval(gameInterval);
               pause=1;
           }
           else{
               gameInterval=window.setInterval("Handle_Interval()",(maxspeed-speed+1)*60);
               pause=0;
           }
           break;
       case 90:        
           Change(1);
           break;
       case 88:    
           Change(-1);
           break;
       default:
   }
   }
}

function Handle_Interval(){
   curX = block_div.style.pixelLeft;
   curY = block_div.style.pixelTop;
   if (CanMove(curX,curY+n_IncStep,arr_curBlock)){
       block_div.style.pixelTop+=n_IncStep;
   }
   else{
       SaveBlock();
       DelLines();
       if (Lucifer()){
           GameOver();
           return;
       }
       sco.innerText=parseInt(sco.innerText)+2
       NewBlock();
   }
   if (killedlines>=clr_per_line){
       killedlines-=clr_per_line;
       if (speed<maxspeed)
           speed++;
       else
           speed=maxspeed;
       spd.innerText=speed;
       clearInterval(gameInterval);
       gameInterval=window.setInterval("Handle_Interval()",(maxspeed-speed+1)*60);
   }
}
//-->
</SCRIPT>

<SCRIPT LANGUAGE=javascript FOR=document EVENT=onkeydown>
<!--
if (document.all)
document_onkeydown()
//-->
</SCRIPT>

</HEAD>

<BODY LANGUAGE=javascript>

<div id=block_div style="left:60;top:0">
<table id=block_tbl border=0 cellspacing=0 cellpadding=0>
<script>
if (document.all){
for (var i=0;i<4;i++){
   document.write("<tr>");
   for (var j=0;j<4;j++){
       document.write("<td style=\"border:1 solid black;\"></td>");
   }
   document.write("</tr>");
}
}
</script>
</table>
</div>

<div id=nblock_div>
<table id=nblock_tbl border=0 cellspacing=0 cellpadding=0>
<script>
if (document.all){
for (var i=0;i<4;i++){
   document.write("<tr>");
   for (var j=0;j<4;j++){
       document.write("<td style=\"height:40;width:40;border:1 outset black;\"></td>");
   }
   document.write("</tr>");
}
}
</script>
</table>
</div>

<div id=table_div>
<table id=table_tbl border=0 cellspacing=0 cellpadding=0>
<script>
if (document.all){
for (var i=0;i<22;i++){
   document.write("<tr>");
   for (var j=0;j<16;j++){
       var d2 = i * 16 + j;
       if (table[d2]==1)
       document.write("<td bgcolor=navy></td>");
       else
       document.write("<td style=\"background:black;\"></td>");
   }
   document.write("</tr>");
}
}
</script>
</table>
</div>

<div id=title_div nowrap>
<font size="3">请在文本框输入(1-9)并按开始键开始游戏: <input type="text" size=8 id="speedin"> <button onClick="begintet()" id="but">开始</button>
<br>
游戏结束后,按"新游戏"键重新开始游戏!<input type="button" value="新游戏" onclick="javascript:window.location.href='eluosi1.htm'">
<input type="button" value="不玩了" onclick="self.close()">
</font>
</div>


<div id=infobar_div>
<table border=1 bordercolor=navy cellspacing=0 cellpadding=0>
<tr align=center>
<td style="color:99ccff;font:12 system;width:56;">速度:</td>
<td style="color:red;font:12 system;" id=spd>1</td>
<td style="color:99ccff;font:12 system;width:86;">总成绩:</td>
<td style="color:red;font:12 system;" id=sco>0</td>
<td style="color:99ccff;font:12 system;width:96;">消减排数:</td>
<td style="color:red;font:12 system;" id=cll>0</td>
</tr>
</table>
</div>

<SCRIPT ID=MainSection LANGUAGE=javascript>
<!--
if (document.all){
ncid = Math.round(Math.random()*(colors.length-1));
bid = Math.round(Math.random()*(blocks.length-1));
nextBlock = blocks[bid];
NewBlock();
}
function begintet(){
document.all.speedin.disabled=true
document.all.but.disabled=true
speed=parseInt(document.all.speedin.value);
if (isNaN(speed)&#124;&#124;speed==null&#124;&#124;speed>maxspeed&#124;&#124;speed<1) speed=1;
spd.innerText=speed;
gameInterval=window.setInterval("Handle_Interval()",(maxspeed-speed+1)*60);
}
//-->
</SCRIPT>
<P>
</BODY>
</HTML>

#include
#include
#include
#include
#include
#include

#define LEFT 0x4b
#define RIGHT 0x4d
#define DOWN 0x50
#define CHANGE 0x20
#define ESC 0x1b
#define INTR 0x1C
#define DefaultX 5
#define DefaultY 1
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif

static unsigned counter=0;
static unsigned shape[7][4][4][4]={
{
{{0,1,1,0},{0,1,1,0},{0,0,0,0},{0,0,0,0}},
{{0,1,1,0},{0,1,1,0},{0,0,0,0},{0,0,0,0}},
{{0,1,1,0},{0,1,1,0},{0,0,0,0},{0,0,0,0}},
{{0,1,1,0},{0,1,1,0},{0,0,0,0},{0,0,0,0}},
},
{
{{0,0,0,0},{1,1,1,1},{0,0,0,0},{0,0,0,0}},
{{0,0,1,0},{0,0,1,0},{0,0,1,0},{0,0,1,0}},
{{0,0,0,0},{1,1,1,1},{0,0,0,0},{0,0,0,0}},
{{0,0,1,0},{0,0,1,0},{0,0,1,0},{0,0,1,0}},
},
{
{{0,1,0,0},{1,1,1,0},{0,0,0,0},{0,0,0,0}},
{{0,1,0,0},{0,1,1,0},{0,1,0,0},{0,0,0,0}},
{{0,0,0,0},{1,1,1,0},{0,1,0,0},{0,0,0,0}},
{{0,1,0,0},{1,1,0,0},{0,1,0,0},{0,0,0,0}},
},
{
{{1,0,0,0},{1,1,0,0},{0,1,0,0},{0,0,0,0}},
{{0,0,0,0},{0,1,1,0},{1,1,0,0},{0,0,0,0}},
{{1,0,0,0},{1,1,0,0},{0,1,0,0},{0,0,0,0}},
{{0,0,0,0},{0,1,1,0},{1,1,0,0},{0,0,0,0}},
},
{
{{0,1,0,0},{1,1,0,0},{1,0,0,0},{0,0,0,0}},
{{0,0,0,0},{1,1,0,0},{0,1,1,0},{0,0,0,0}},
{{0,1,0,0},{1,1,0,0},{1,0,0,0},{0,0,0,0}},
{{0,0,0,0},{1,1,0,0},{0,1,1,0},{0,0,0,0}},
},
{
{{1,0,0,0},{1,0,0,0},{1,1,0,0},{0,0,0,0}},
{{0,0,0,0},{1,1,1,0},{1,0,0,0},{0,0,0,0}},
{{1,1,0,0},{0,1,0,0},{0,1,0,0},{0,0,0,0}},
{{0,0,0,0},{0,0,1,0},{1,1,1,0},{0,0,0,0}},
},
{
{{0,1,0,0},{0,1,0,0},{1,1,0,0},{0,0,0,0}},
{{0,0,0,0},{1,0,0,0},{1,1,1,0},{0,0,0,0}},
{{1,1,0,0},{1,0,0,0},{1,0,0,0},{0,0,0,0}},
{{0,0,0,0},{1,1,1,0},{0,0,1,0},{0,0,0,0}},
},
};

unsigned back[22][14]={{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,0,0,0,0,0,0,0,0,0,0,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1}};

char ShapeColor[7]={8,10,11,12,13,14,15};
char DigitalShape[10]={128+119,3,62,31,128+75,128+93,128+125,19,128+127,128+95};
char ZodiacBack[11]={4,6,12,13,11,10,2,3,9,1,8};
char ZodiacSoft[18][14]={{0,0,0,0,96,0,0,0,0,0,0,0,60,0},
{255,248,0,0,96,0,0,0,0,248,0,0,124,0},
{255,248,0,0,97,128,0,0,3,248,0,0,192,0},
{0,112,0,0,97,128,0,0,7,0,0,1,128,48},
{0,224,0,0,96,0,0,0,14,0,0,1,128,48},
{1,192,0,0,96,0,0,0,12,0,0,1,128,48},
{3,128,120,15,97,128,240,60,12,0,15,15,249,255},
{7,0,252,31,225,131,248,127,14,0,31,143,249,255},
{7,1,142,48,225,135,24,227,7,240,49,193,128,48},
{14,3,134,96,97,142,24,192,3,252,112,193,128,48},
{28,3,6,96,97,140,25,192,0,28,96,193,128,48},
{56,3,6,96,97,140,25,128,0,6,96,193,128,48},
{56,3,6,96,97,140,25,128,0,6,96,193,128,48},
{120,3,6,96,97,140,25,128,0,6,96,193,128,48},
{224,1,140,48,225,142,25,195,24,14,49,129,128,48},
{255,249,252,63,225,135,252,255,28,28,63,129,128,48},
{255,248,240,15,97,131,236,60,15,248,30,1,128,48},
{0,0,0,0,0,0,0,0,7,224,0,1,128,0}};

unsigned long TotalMark=0;
unsigned int Erasered=0,ETimes=0;
int Speed=0;
int CEr=0;
int NumOfLev[5]={0,0,0,0,0};
int TimeDelay[10]={21,18,17,15,13,11,9,7,5,3};
char NewShape[2];
unsigned PerOnce[4];

void interrupt ( *oldhandler)(__CPPARGS);
void interrupt handler(__CPPARGS)
{
++counter;
oldhandler();
}

void DrawBackground()
{
//setlinestyle
}
void DrawDigital(int x,int y,int a)
{
int i=7;
setcolor(((DigitalShape[a]>>i)&1)*7+4);
//printf("%d",(DigitalShape[a]>>i)&1);
i--;
line(x,y+1,x,y+15);
line(x+1,y+2,x+1,y+14);
line(x+2,y+3,x+2,y+13);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x,y+17,x,y+31);
line(x+1,y+18,x+1,y+30);
line(x+2,y+19,x+2,y+29);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x,y+17,x,y+31);
line(x+1,y+18,x+1,y+30);
line(x+2,y+19,x+2,y+29);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+1,y,x+16,y);
line(x+2,y+1,x+15,y+1);
line(x+3,y+2,x+14,y+2);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+2,y+15,x+15,y+15);
line(x+1,y+16,x+16,y+16);
line(x+2,y+17,x+15,y+17);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+3,y+30,x+14,y+30);
line(x+2,y+31,x+15,y+31);
line(x+1,y+32,x+16,y+32);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
i--;
line(x+15,y+3,x+15,y+13);
line(x+16,y+2,x+16,y+14);
line(x+17,y+1,x+17,y+15);
setcolor(((DigitalShape[a]>>i)&1)*7+4);
line(x+15,y+19,x+15,y+29);
line(x+16,y+18,x+16,y+30);
line(x+17,y+17,x+17,y+31);
}

void ArtClear()
{
for(int i=480;i>=0;i-=2)
{
setcolor(3);
line(0,i-6,639,i-6);
setcolor(9);
line(0,i-4,639,i-4);
setcolor(1);
line(0,i-2,639,i-2);
setcolor(getbkcolor());
line(0,i,639,i);
delay(1);
}
for(i=1;i<480;i+=2)
{
setcolor(3);
line(0,i+6,639,i+6);
setcolor(9);
line(0,i+4,639,i+4);
setcolor(1);
line(0,i+2,639,i+2);
setcolor(getbkcolor());
line(0,i,639,i);
delay(1);
}
}

void end()
{
for(int j=0;j<4;j++)
{
for(int i=j;i<480;i+=4)
{
setcolor(3);
line(0,i+8,639,i+8);
setcolor(9);
line(0,i+4,639,i+4);
setcolor(1);
line(0,i,639,i);
setcolor(getbkcolor());
line(0,i,639,i);
delay(1);
}
delay(5);
}
setcolor(YELLOW);
outtextxy(260,200,"[ Game Over ]");
gotoxy(14,16);
printf("This freeware is written by Daniel.Qu ZodiacSoft 2000");
gotoxy(12,17);
printf("Please e-mail to swami@yeah.net or visit my homepage at");
gotoxy(12,18);
printf("http://grocery.2699.com if you have question.");
gotoxy(14,20);
printf("I will soon provide something new,please wait...");
gotoxy(14,22);
printf("We hold these truths to be self-evident,that all codes");
gotoxy(12,23);
printf("are created FREE.");
getch();
clrscr();
closegraph();
exit(0);
}

void ShowTitle()
{
int gdriver=DETECT,gmode,errorcode,i,j,k;
initgraph(&gdriver,&gmode,"");
errorcode=graphresult();
if (errorcode!=grOk)
{
printf("Graphics error: %s\n\007",grapherrormsg(errorcode));
exit(1);
}
setbkcolor(9);//This line needs to be changed
for(i=0;i<11;i++)
{
setcolor(ZodiacBack[i]);
line(200,i*8+100,440,i*8+100);
}
delay(1000);
for(j=0;j<17;j++)
for(i=0;i<11;i++)
{
setcolor(ZodiacBack[(i+j)%16]);
line(200,i*8+100,440,i*8+100);
delay(4);
}
for(j=0;j<18;j++)
{
for(i=0;i<14;i++)
{
for(k=7;k>=0;k--)
if((ZodiacSoft[j][i]>>k)&1)
{
putpixel(i*8-k+271,j+122,14);
}
}
delay(10);
}
for(j=17;j>=0;j--)
{
for(i=0;i<14;i++)
for(k=7;k>=0;k--)
{
if((ZodiacSoft[j][i]>>k)&1)
putpixel(i*8-k+271,158-j,5);
}
delay(10);
}
setcolor(15);
outtextxy(295,171,"Present");
getch();
ArtClear();
}

void DrawShape(int x,int y,int color)
{
//if(x<2||x>12||y>19)
// return;
setcolor(color);
/*line(x<<4,y<<4,x<<4,(y<<4)+14);
line(x<<4,(y<<4)+14,(x<<4)+14,(y<<4)+14);
line((x<<4)+14,(y<<4)+14,(x<<4)+14,y*16);
line((x<<4)+14,y<<4,x<<4,y*16);
line((x<<4)+1,y<<4,(x<<4)+1,(y<<4)+14);
line((x<<4)+1,(y<<4)+13,(x<<4)+14,(y<<4)+13);
line((x<<4)+13,(y<<4)+13,(x<<4)+13,(y<<4)+1);
line((x<<4)+13,(y<<4)+1,x<<4,(y<<4)+1); */
for(int i=0;i<15;i++)
line(x<<4,(y<<4)+i,(x<<4)+14,(y<<4)+i);
setcolor(8);
line((x<<4)+15,(y<<4)+1,(x<<4)+15,(y<<4)+15);
line((x<<4)+1,(y<<4)+15,(x<<4)+15,(y<<4)+15);
setcolor(color-8);
line((x<<4)+2,(y<<4)+2,(x<<4)+12,(y<<4)+2);
line((x<<4)+2,(y<<4)+2,(x<<4)+2,(y<<4)+12);
}

void DrawNull(int x,int y)
{
setcolor(getbkcolor());
for(int i=0;i<16;i++)
line(x<<4,(y<<4)+i,(x<<4)+15,(y<<4)+i);
}

void show(int x,int y,int CurrentShape,int Status)
{
int temp;
for(int i=0;i<20;i++)
for(int j=2;j<12;j++)
{
if(back[i][j]==1)
DrawShape(6+j,4+i,8);
else
DrawNull(6+j,4+i);
} //no matter what the status be,I will draw the background
for(int l=0;l<4;l++)
for(int p=0;p<4;p++)
{
if(l+x<2||x+l>11||p+y>19)
continue;
//if(shape[CurrentShape][Status][p][l]+back[y+p][x+l]==1)
// DrawShape(3+l+x,3+p+y,8+CurrentShape);
//else
//cout<<'O';
// DrawNull(3+j,3+i);
if(shape[CurrentShape][Status][p][l]==1)
DrawShape(6+l+x,4+p+y,ShapeColor[CurrentShape]);
if(back[y+p][x+l]==1)
DrawShape(6+l+x,4+p+y,8);
}
}
void DrawScore()
{
int temp=TotalMark;
for(int i=0;i<7;i++)
{
DrawDigital(477-i*20,65,temp%10);
temp/=10;
}
temp=Erasered;
for(i=0;i<4;i++)
{
DrawDigital(491-i*20,111,temp%10);
temp/=10;
}
if(Erasered==0)
return;
for(i=1;i<5;i++)
{
setfillstyle(1,8);
bar(378,163+i*14,508,170+i*14);
setfillstyle(1,5);
bar(378,163+i*14,378+130*NumOfLev[i]/ETimes,170+i*14);
}
DrawDigital(466,293,Speed);
return;
}

int CreateNewShape()
{
NewShape[1]=NewShape[0];
NewShape[0]=rand()%7;
setfillstyle(1,0);
bar(447,240,514,288);
for(int l=0;l<4;l++)
for(int p=0;p<4;p++)
if(shape[NewShape[0]][0][p][l]==1)
DrawShape(28+l,15+p,ShapeColor[7]);
return NewShape[1];
}

int Possible(int x,int y,int CurrentShape,int Status)
{
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
if(shape[CurrentShape][Status][i][j]+back[y+i][x+j]==2)
//this line can also write as the following type:
//if(shape[CurrentShape][Status][i][j]&&back[y+i][x+j])
return 0;
}
}
return 1;
}

void GoLeft(int&x,int&y,int&CurrentShape,int&Status)
{
if(Possible(x-1,y,CurrentShape,Status))
x--;
show(x,y,CurrentShape,Status);
}

void GoRight(int&x,int&y,int&CurrentShape,int&Status)
{
if(Possible(x+1,y,CurrentShape,Status))
x++;
show(x,y,CurrentShape,Status);
}

void GoDown(int&x,int&y,int&CurrentShape,int&Status)
{
int AllAreOne=1,temp=0;
if(Possible(x,y+1,CurrentShape,Status))
{
y++;
show(x,y,CurrentShape,Status);
return;
}
TotalMark+=3*CurrentShape;
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
back[i+y][j+x]+=shape[CurrentShape][Status][i][j];
for(int r=1;r<20;r++)
{
for(int l=2;l<13;l++)
{
if(back[r][l]==0)
AllAreOne=0;
}
if(AllAreOne==1)
{
for(int rr=r;rr>0;rr--)
for(int ll=2;ll<13;ll++)
back[rr][ll]=back[rr-1][ll];
Erasered++;
CEr++;
temp++;
}
AllAreOne=1;
}
CurrentShape=CreateNewShape();
x=DefaultX;y=DefaultY;Status=0;
NumOfLev[temp]++;
TotalMark+=5*temp;
show(x,y,CurrentShape,Status);
counter=0;
if(!Possible(x,y,CurrentShape,Status))
{
getch();
end();
}
if(CEr>=30)
{
Speed=(Speed+1)%10;
CEr/=30;
}
if(temp)
ETimes++;
DrawScore();
return;
}

void ChageShape(int&x,int&y,int&CurrentShape,int&Status)
{
if(Possible(x,y,CurrentShape,(Status+1)%4))
Status=(Status+1)%4;
show(x,y,CurrentShape,Status);
}

void DrawFace()
{
int temp;
setcolor(15);
line(351,59,519,59);
line(351,60,518,60);
line(351,59,351,156);
line(352,59,352,155);
setcolor(7);
line(518,61,518,154);
line(519,60,519,154);
line(353,155,519,155);
line(352,156,519,156);
setcolor(8);
for(int i=61;i<155;i++)
line(353,i,517,i);
setcolor(7);
line(427,106,512,106);
line(428,107,511,107);
line(427,106,427,147);
line(428,106,428,146);
setcolor(15);
line(512,106,512,147);
line(511,107,511,146);
line(428,146,511,146);
line(427,147,512,147);
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
setcolor(14);
outtextxy(357,119,"Erasered");
outtextxy(370,130,"Level:");
setcolor(15);
line(352,167,519,167);
line(352,168,518,168);
line(352,169,352,407);
line(353,169,353,406);
setcolor(7);
line(519,167,519,407);
line(518,168,518,406);
line(352,407,519,407);
line(353,406,519,406);
line(524,55,89,55); //outter border 1st
line(524,55,524,411);
line(89,411,524,411);
line(89,55,89,411);
line(524,56,89,56); //outter border 2nd
line(525,55,525,411);
line(89,410,524,410);
line(88,55,88,411);
setfillstyle(8,7);
bar(94,59,336,406);
//setfillstyle(1,3);
//bar(128,78,296,386);
for(i=0;i<8;i++)
DrawDigital(357+i*20,65,0);
for(i=0;i<4;i++)
DrawDigital(431+i*20,111,0);
setfillstyle(1,8);
setcolor(12);
for(i=0;i<4;i++)
{
temp=i+'1';
outtextxy(364,177+14*i,(char*)&temp);
bar(378,177+i*14,508,184+i*14);
}
setcolor(14);
outtextxy(366,250,"Next Shape");
setcolor(10);
outtextxy(366,294,"Current");
outtextxy(382,309,"Level");
setcolor(6);
outtextxy(366,334,"Message:");
bar(362,348,509,398);
DrawDigital(466,293,Speed);
}

void WannaQuit()
{
int choise=0,temp;
setfillstyle(1,8);
bar(362,348,509,398);
setcolor(15);
outtextxy(378,355,"Are you sure to");
outtextxy(368,368,"quit game?");
outtextxy(410,388,"Yes");
outtextxy(470,388,"No");
setcolor(14);
circle(399,392,4);
while((temp=bioskey(0))!=7181)
{
if(temp==19200)
{
setcolor(8);
circle(459,392,4);
choise=0;
setcolor(14);
circle(399,392,4);
}
if(temp==19712)
{
setcolor(8);
circle(399,392,4);
choise=1;
setcolor(14);
circle(459,392,4);
}
}
if(choise==0)
{
end();
}
setfillstyle(1,8);
bar(362,348,509,398);
return;
}

void main()
{
ShowTitle();
unsigned c;
int CurrentShape,x=6,y=0,Status=0;
oldhandler=getvect(INTR);
setvect(INTR,handler);
randomize();
NewShape[0]=rand()%7;
DrawFace();
CurrentShape=CreateNewShape();
show(x,y,CurrentShape,Status);
while(1)
{
if(kbhit())
{
c=getch();
if(c==0)
c=getch();
switch(c)
{
case 's' :Speed=(Speed+1)%10;DrawDigital(466,293,Speed);break;
case DOWN :GoDown(x,y,CurrentShape,Status);break;
case LEFT :GoLeft(x,y,CurrentShape,Status);break;
case RIGHT :GoRight(x,y,CurrentShape,Status);break;
case CHANGE :ChageShape(x,y,CurrentShape,Status);break;
case ESC :WannaQuit();
}
}
if((counter%=TimeDelay[Speed])==(TimeDelay[Speed]-1))
{
GoDown(x,y,CurrentShape,Status);
counter=0;
}
}
}

[p align=center]一、jsp连接Oracle8/8i/9i数据库(用thin模式)
testoracle.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

String url="jdbc:oracle:thin:@localhost:1521:orcl";

//orcl为你的数据库的SID

String user="scott";

String password="tiger";

Connection conn= DriverManager.getConnection(url,user,password);

Statement stmt=conn.createStatement

(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>





阅读全文

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();

String url ="jdbc:mysql://localhost/softforum?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1";

//testDB为你的数据库名

Connection conn= DriverManager.getConnection(url);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>



一、jsp连接Oracle8/8i/9i数据库(用thin模式)
testoracle.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

String url="jdbc:oracle:thin:@localhost:1521:orcl";

//orcl为你的数据库的SID

String user="scott";

String password="tiger";

Connection conn= DriverManager.getConnection(url,user,password);

Statement stmt=conn.createStatement

(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>







二、jsp连接Sql Server7.0/2000数据库
testsqlserver.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";

//pubs为你的数据库的

String user="sa";

String password="";

Connection conn= DriverManager.getConnection(url,user,password);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>






三、jsp连接DB2数据库
testdb2.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();

String url="jdbc:db2://localhost:5000/sample";

//sample为你的数据库名

String user="admin";

String password="";

Connection conn= DriverManager.getConnection(url,user,password);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>







四、jsp连接Informix数据库
testinformix.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("com.informix.jdbc.IfxDriver").newInstance();

String url = "jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;

user=testuser;password=testpassword";

//testDB为你的数据库名

Connection conn= DriverManager.getConnection(url);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>







五、jsp连接Sybase数据库
testmysql.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("com.sybase.jdbc.SybDriver").newInstance();

String url =" jdbc:sybase:Tds:localhost:5007/tsdata";

//tsdata为你的数据库名

Properties sysProps = System.getProperties();

SysProps.put("user","userid");

SysProps.put("password","user_password");

Connection conn= DriverManager.getConnection(url, SysProps);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>







六、jsp连接MySQL数据库
testmysql.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();

String url ="jdbc:mysql://localhost/softforum?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1";

//testDB为你的数据库名

Connection conn= DriverManager.getConnection(url);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>







七、jsp连接PostgreSQL数据库
testmysql.jsp如下:

<%@ page contentType="text/html;charset=gb2312"%>

<%@ page import="java.sql.*"%>





<%Class.forName("org.postgresql.Driver").newInstance();

String url ="jdbc:postgresql://localhost/soft";

//soft为你的数据库名

String user="myuser";

String password="mypassword";

Connection conn= DriverManager.getConnection(url,user,password);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String sql="select * from test";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next()) {%>

您的第一个字段内容为:<%=rs.getString(1)%>

您的第二个字段内容为:<%=rs.getString(2)%>

<%}%>

<%out.print("数据库操作成功,恭喜你");%>

<%rs.close();

stmt.close();

conn.close();

%>





 八、jsp连接Access数据库


<%@page import="java.sql.*"
import ="java.util.*"
import ="java.io.*"
import="java.text.*"
contentType="text/html; charset=gb2312"
buffer="20kb"
%><%! int all,i,m_count;
String odbcQuery;
Connection odbcconn;
Statement odbcstmt;
ResultSet odbcrs;
String username,title,content,work,email,url,time,date;
String datetime;
%>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch (ClassNotFoundException e)
{ out.print ("驱动程序不存在");
}
try{
odbcconn = DriverManager.getConnection("jdbc:odbc:db1");
odbcstmt = odbcconn.createStatement();
odbcQuery="Select * From book where datetime>2001-4-26 Order By datetime DESC";
odbcrs=odbcstmt.executeQuery(odbcQuery);
int i=0;
while (i<130) odbcrs.next();
while (odbcrs.next())
{
//*/////////////////////////显示数据库的内容用于调试程序是用//
int ii;
try{
try{
for (ii=1;;ii++)
out.print ("<br>Cloumn "+ii+" is: "+odbcrs.getString(ii));
}catch (NullPointerException e) {
out.print ("有空的指针");
}
}catch (SQLException e){
}
}
odbcrs.close();
odbcstmt.close();
odbcconn.close();
}catch (SQLException e)
{ out.print (e);
}
%>

分页: 265/271 第一页 上页 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 下页 最后页 [ 显示模式: 摘要 | 列表 ]