About neohope

一直在努力,还没想过要放弃...

JQuery实现li菜单

$(function() {
	var ctrl = document.getElementById("mainframe");
	var $div_li = $("div.div_header ul li");
	$div_li.click(function() {
		var index = $div_li.index(this);
		
		if (index != 4){
			$("li.selected").removeClass( "selected" );
			$(this).addClass("selected");
		}
		
		if (index == 0) {ctrl.src = "";} 
		else if (index == 1) {ctrl.src = "";} 
		else if (index == 2) {ctrl.src = "";}
		else if (index == 3) {ctrl.src = "";} 
		else if (index == 4) {window.location.href = "logout.jsp";}
	}).hover(function() {
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");
	});
});

JS对话框


alert("你好");

if(confirm(你现在快乐吗?)){
	alert("真为你高兴");
}
else
{
	alert("没关系,都会好起来的,对自己好一些");
}

var m=window.prompt("你今年几岁了啊");
alert("你今年"+m+"岁了");

JS单双色表格

//id,颜色a,颜色b
function DColorTable(tid, colora, colorb)
{
	var ctrl = document.getElementById(tid);
	if(ctrl==null)return;
	
	var trs = ctrl.getElementsByTagName("tr");
	
	for ( var i = 0; i < trs.length; i++)
	{
		trs[i].style.backgroundColor = (trs[i].sectionRowIndex % 2 == 0) ? colora : colorb;
	}
}

DColorTable("dcolorTable","#FFFFFF","#c6e1fd");

JQuery获取页面宽度及高度

//返回当前页面高度
function pageHeight(){
	if($.browser.msie){
		return document.compatMode == "CSS1Compat"? document.documentElement.clientHeight :
		document.body.clientHeight;
	}else{
		return self.innerHeight;
	}
};



//返回当前页面宽度
function pageWidth(){
	if($.browser.msie){
		return document.compatMode == "CSS1Compat"? document.documentElement.clientWidth :
		document.body.clientWidth;
	}else{
		return self.innerWidth;
	}
}; 

struts2返回类型

Chain:
Action响应链,用于多个Action处理一次请求,
后面的Action可以访问前面的Action,不要过度使用

Dispatcher:
网络资源整合,如返回JSP页面,默认

FreeMarker:
用于FreeMarker整合

HttpHeader:
控制特定的HTTP行为

Redirect:
重定向到网络资源

Redirect Action:
重定向到另一个Action映射

Stream:
用于向浏览器提供输入流,一般用于文件下载

Velocity:
用于Velocity整合

XSL:
用于XML/XSLT整合

PlainText:
用于显示页面的原始内容

Tiles:
用于Tiles整合

MyEclipe中Java工程手动增加Maven支持

1修改文件.project

<buildSpec>
	<buildCommand>
		<name>org.maven.ide.eclipse.maven2Builder</name>
		<arguments>
		</arguments>
	</buildCommand>
</buildSpec>
<natures>
	<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>

2.修改文件.classpath

<classpath>
	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
</classpath>

3.新增文件pom.xml

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&#93;
  <modelVersion>4.0.0</modelVersion>

  <groupId>groupId</groupId>
  <artifactId>artifactId</artifactId>
  <version>1.0</version>
  <name>name</name>
 
  <dependencies>
  </dependencies>

  <build>
      <plugins>
      </plugins>
  </build>  
</project>