2007-03-16

用JavaScript实现仿Windows关机效果

来源: CSDN 作者:佚名 评论 0 条
 
var ctrl=$('lightbox');
//为高亮层添加事件处理方法reset
Event.observe(ctrl, 'click', this.reset.bindAsEventListener(this), false);
ctrl.onclick = function(){return false;};
},
//恢复初始状态
reset:function(){
//隐藏覆盖层
$('overlay').style.display="none";
//清空返回数据
$('lbContent').innerHTML="";
//隐藏高亮层
$('lightbox').style.display="none";
},
// Search through new links within the lightbox, and attach click event
actions: function(){
lbActions = document.getElementsByClassName('lbAction');
for(i = 0; i < lbActions.length; i ) {
Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAs EventListener(this), false);
lbActions[i].onclick = function(){return false;};
}
}
}

提示:由于该对象比较复杂,读者可以仔细参阅代码的注释部分。

服务器端代码

服务器端首先获得查询中的“id”值,假如该值为null或为空,则设置为默认值。然后判定该值,并且返回相应的一段字符串信息。处理请求的getInfohtml" class="wordstyle">jsp页面代码如下:


<%@ page language="java" import="java.util.*"%>
<%
//获得请求中id的值
String imgID = request.getParameter("id");
if (imgID==null||imgID.equals(""))//假如为null或为空
imgID="one";//设定为默认值
if ( imgID.equals("one"))//假如为one
{
%>
<h3 id="cartitle" style="border-bottom: 1px solid #C0C0C0; margin-bottom: -5px">Porsche Carrera GT</h3>
<p>The Carrera GT has a 5.7 litre V10 internal combustion engine that produces
605 SAE horsepower (451 kW). Porsche claims it will accelerate from 0 to 100
km/h (62 mph) in 3.9 seconds and has a maximum speed of 330 km/h (204 mph).
With 605 hp, the car weighs 1,380 kg (3,042 lb). The Carrera GT is only
offered with a six-speed manual transmission, in contrast to its rival the
Ferrari Enzo that is only offered with sequential manual transmission. Also
the Carrera GT is significantly less expensive than the Ferrari Enzo. The
Ferrari Enzo is priced around $660,000 to the Carrera GT's $440,000. The
Carrera GT is known for its high quality and reliability which makes it one of
the best supercars ever.
<%}else{//否则
%>
<h3 id="cartitle" style="border-bottom: 1px solid #C0C0C0; margin-bottom: -5px">Ferrari Testarossa</h3>
<p>The Ferrari Testarossa is an V12 mid-engined sports car made by Ferrari.
The name, which means &quot;red head&quot;, comes from the red painted cylinder heads on
the flat-12 engine. The engine was technically a 180?V engine since it shared
共6页: 上一页 [1] [2] [3] [4] 5 [6] 下一页

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:HTML基础教程:学习掌握HTML 元素  
下一篇:使用XHTML按标准重构网站
    评论加载中…

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号