display标签扩展:鼠标经过行变色功能[超级简单、通用]

package com.wallimn.gyz.util;

import org.displaytag.decorator.TableDecorator;

/**
 * 超级简单的实现displaytag标签表格行鼠标经过变色功能<br/>
 * 博客:http://wallimn.iteye.com,转载请保留此信息!!<br/>
 * 编码:wallimn 时间:2009-9-24 下午05:05:30<br/>
 * 版本:V1.0<br/>
 */
public class OverOutWrapper extends TableDecorator {
	public OverOutWrapper(){
		super();
	}
	@Override
	public String addRowId() {
		return "i_d\" onmouseover=\"if (typeof(window.m_over)=='function') window.m_over(this);\" onmouseout=\"if (typeof(window.m_out)=='function') window.m_out(this);\" title=\"博客:http://wallimn.iteye.com";
	}
}

 二、jsp测试代码 

Jsp代码
<script type="text/javascript">
	function m_over(tr){
		tr.className=tr.className + " " + "trmo";
	}
	function m_out(tr){
		var cn = tr.className.replace(/\s+trmo/,'');
		tr.className = cn;
	}
</script>
<style type="text/css">
	.trmo{
		background-color:#FFCCFF !important;
	}
</style>
<h3>隔壁老王(http://wallimn.iteye.com)</h3>
<display:table name="${items}" id="row" class="gyz dtt" decorator="com.wallimn.gyz.util.OverOutWrapper">
    <display:column property="dm" title="代码" style="width:60px" />
    <display:column property="mc" title="名称"/>
</display:table>
 

相关推荐