<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>skycxy</title>
    <description></description>
    <link>http://skycxy.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>怎么实现一个POJO对应多个不同的数据库表</title>
        <author>skycxy</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://skycxy.javaeye.com">skycxy</a>&nbsp;
          链接：<a href="http://skycxy.javaeye.com/blog/108537" style="color:red;">http://skycxy.javaeye.com/blog/108537</a>&nbsp;
          发表时间: 2007年08月03日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><font face="Arial">首先先建好一个pojo类,</font></p>
<p><font face="Arial">public class IcWsprice implements Serializable<br />
{</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; /**<br />
&nbsp;&nbsp;&nbsp;&nbsp; * <br />
&nbsp;&nbsp;&nbsp;&nbsp; */<br />
&nbsp;&nbsp;&nbsp; private static final long serialVersionUID = 1L;</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;</font><font face="Arial">&nbsp;&nbsp;&nbsp; // primary key<br />
&nbsp;&nbsp;&nbsp; private java.util.Calendar icEffdate;</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; private java.lang.String icCode;</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; private java.lang.String icArea;</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; // fields<br />
&nbsp;&nbsp;&nbsp; private java.lang.Integer icOWp;</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; private java.lang.Integer icWp</font></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; ..............</p>
<p>}</p>
<p>在hibernate 中mapping</p>
<p><font face="Arial">&lt;?xml version=&quot;1.0&quot;?&gt;<br />
&lt;!DOCTYPE hibernate-mapping PUBLIC<br />
&nbsp;&quot;-//Hibernate/Hibernate Mapping DTD//EN&quot;<br />
&nbsp;&quot;http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&quot; &gt;</font></p>
<p><font face="Arial">&lt;hibernate-mapping package=&quot;com.fortuneduck.ic.vo&quot;&gt;<br />
&nbsp;&lt;class name=&quot;IcWsprice&quot; table=&quot;IC_HB_WSPRICE&quot; entity-name=&quot;IcHBWsprice&quot;&gt;<br />
&nbsp;&nbsp;&lt;composite-id&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_EFFDATE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icEffDate&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;java.util.Calendar&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_CODE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icCode&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_AREA&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icArea&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;/composite-id&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_O_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icOWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&lt;/class&gt;<br />
&nbsp;&lt;class name=&quot;IcWsprice&quot; table=&quot;IC_LG_WSPRICE&quot; entity-name=&quot;IcLGWsprice&quot;&gt;<br />
&nbsp;&nbsp;&lt;composite-id&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_EFFDATE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icEffDate&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;java.util.Calendar&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_CODE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icCode&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_AREA&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icArea&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;/composite-id&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_O_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icOWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&lt;/class&gt;<br />
&nbsp;<br />
&nbsp;&lt;class name=&quot;IcWsprice&quot; table=&quot;IC_WA_WSPRICE&quot; entity-name=&quot;IcWAWsprice&quot;&gt;<br />
&nbsp;&nbsp;&lt;composite-id&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_EFFDATE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icEffDate&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;java.util.Calendar&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_CODE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icCode&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_AREA&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icArea&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;/composite-id&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_O_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icOWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&lt;/class&gt;<br />
&nbsp;<br />
&nbsp;&lt;class name=&quot;IcWsprice&quot; table=&quot;IC_WT_WSPRICE&quot; entity-name=&quot;IcWTWsprice&quot;&gt;<br />
&nbsp;&nbsp;&lt;composite-id&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_EFFDATE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icEffDate&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;java.util.Calendar&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_CODE&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icCode&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;key-property<br />
&nbsp;&nbsp;&nbsp;&nbsp;column=&quot;IC_AREA&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;icArea&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;string&quot;<br />
&nbsp;&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;/composite-id&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_O_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icOWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&nbsp;&lt;property<br />
&nbsp;&nbsp;&nbsp;column=&quot;IC_WP&quot;<br />
&nbsp;&nbsp;&nbsp;length=&quot;5&quot;<br />
&nbsp;&nbsp;&nbsp;name=&quot;icWp&quot;<br />
&nbsp;&nbsp;&nbsp;not-null=&quot;false&quot;<br />
&nbsp;&nbsp;&nbsp;type=&quot;integer&quot;<br />
&nbsp;&nbsp; /&gt;<br />
&nbsp;&lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;<br />
</font></p>
<p><font face="Arial">这样就可以在DAO中找到不同的的表对应的实体了</font></p>
<font face="Arial">
<p><br />
public class ProductlineUtils<br />
{<br />
&nbsp;&nbsp;&nbsp; private static Map productlines = new HashMap();</p>
<p>&nbsp;&nbsp;&nbsp; static<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map hb = new HashMap();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map wa = new HashMap();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map ls = new HashMap();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map lg = new HashMap();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map wt = new HashMap();</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; productlines.put(&quot;HB&quot;, hb);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; productlines.put(&quot;WA&quot;, wa);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; productlines.put(&quot;LS&quot;, ls);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; productlines.put(&quot;LG&quot;, lg);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; productlines.put(&quot;WT&quot;, wt);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;main1&quot;, &quot;Handbag&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;main1&quot;, &quot;Wallet&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;main1&quot;, &quot;Shoes&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;main1&quot;, &quot;HPHandbag&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;main1&quot;, &quot;HPWallet&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;stdGrade&quot;, &quot;HBStdGrade&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;stdGrade&quot;, &quot;WAStdGrade&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;stdGrade&quot;, &quot;LSStdGrade&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;stdGrade&quot;, &quot;LGStdGrade&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;stdGrade&quot;, &quot;WTStdGrade&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;pradj&quot;, &quot;IcHBPradj&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;pradj&quot;, &quot;IcWAPradj&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;pradj&quot;, &quot;IcLSPradj&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;pradj&quot;, &quot;IcLGPradj&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;pradj&quot;, &quot;IcWTPradj&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;prelat&quot;, &quot;IcHBPrelat&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;prelat&quot;, &quot;IcWAPrelat&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;prelat&quot;, &quot;IcLSPrelat&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;prelat&quot;, &quot;IcLGPrelat&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;prelat&quot;, &quot;IcWTPrelat&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;pgroup&quot;, &quot;IcHBPgroup&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;pgroup&quot;, &quot;IcWAPgroup&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;pgroup&quot;, &quot;IcLSPgroup&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;pgroup&quot;, &quot;IcLGPgroup&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;pgroup&quot;, &quot;IcWTPgroup&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;overs&quot;, &quot;IcHBOvers&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;overs&quot;, &quot;IcWAOvers&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;overs&quot;, &quot;IcLSOvers&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;overs&quot;, &quot;IcLGOvers&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;overs&quot;, &quot;IcWTOvers&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;price&quot;, &quot;IcHBPrice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;price&quot;, &quot;IcWAPrice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;price&quot;, &quot;IcLSPrice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;price&quot;, &quot;IcLGPrice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;price&quot;, &quot;IcWTPrice&quot;);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hb.put(&quot;wsprice&quot;, &quot;IcHBWsprice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wa.put(&quot;wsprice&quot;, &quot;IcWAWsprice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls.put(&quot;wsprice&quot;, &quot;IcLSWsprice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lg.put(&quot;wsprice&quot;, &quot;IcLGWsprice&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wt.put(&quot;wsprice&quot;, &quot;IcWTWsprice&quot;);<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; public static Map getParametersOf(String icProductline)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (Map) productlines.get(icProductline);<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; public static String getEntity(String icProductline, String key)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map ps = (Map) productlines.get(icProductline);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ps == null)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return null;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (String) ps.get(key);<br />
&nbsp;&nbsp;&nbsp; }<br />
}</p>
<p><font face="Arial">DAO 中:</font></p>
<font face="Arial">
<p><font face="Arial">package com.fortuneduck.ic.dao.ic180;</font></p>
<p><font face="Arial">import java.util.Calendar;<br />
import java.util.Iterator;<br />
import java.util.List;<br />
import java.util.Map;</font></p>
<p><font face="Arial">import org.apache.commons.logging.Log;<br />
import org.apache.commons.logging.LogFactory;<br />
import org.hibernate.Query;<br />
import org.hibernate.Session;<br />
import org.hibernate.Transaction;<br />
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;</font></p>
<p><font face="Arial">import com.fortuneduck.ic.util.PageSeparator;<br />
import com.fortuneduck.ic.util.ProductlineUtils;<br />
import com.fortuneduck.ic.vo.IcPgroup;<br />
import com.fortuneduck.ic.vo.IcWsprice;</font></p>
<p><font face="Arial">public class IC180_DAOImpl extends HibernateDaoSupport implements IC180_DAO {</font></p>
<p><font face="Arial">&nbsp;private static final Log log = LogFactory.getLog(IC180_DAOImpl.class);</font></p>
<p><font face="Arial">&nbsp;/**<br />
&nbsp; * 查找一个IcPrice's object<br />
&nbsp; * <br />
&nbsp; * @param a<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String &lt;code&gt;icCode&lt;/code&gt;<br />
&nbsp; * @param a<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String &lt;code&gt;area&lt;/code&gt;<br />
&nbsp; * @param a<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Calendar &lt;code&gt;effDate&lt;/code&gt;<br />
&nbsp; * @param a<br />
&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String &lt;code&gt;icProductline&lt;/code&gt;<br />
&nbsp; * <br />
&nbsp; * @return a IcPrice's object<br />
&nbsp; */<br />
&nbsp;public IcWsprice getIcWsprice(String icProductline, String icCode,<br />
&nbsp;&nbsp;&nbsp;String area, Calendar effDate) {<br />
&nbsp;&nbsp;Session s = getSession();<br />
&nbsp;&nbsp;try {</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp;Transaction tx = s.beginTransaction();</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp;Query q = s.createQuery(&quot; FROM &quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ ProductlineUtils.getEntity(icProductline, &quot;wsprice&quot;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ &quot; p WHERE p.icCode=? AND p.icArea=? AND p.icEffDate=? &quot;);<br />
&nbsp;&nbsp;&nbsp;q.setString(0, icCode);<br />
&nbsp;&nbsp;&nbsp;q.setString(1, area);<br />
&nbsp;&nbsp;&nbsp;q.setCalendar(2, effDate);</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp;List list = q.list();<br />
&nbsp;&nbsp;&nbsp;tx.commit();<br />
&nbsp;&nbsp;&nbsp;</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp;if (list != null &amp;&amp; list.size() &gt; 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;log.info(&quot;list&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;return (IcWsprice) list.get(0);</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;log.info(&quot;list is null&quot;);<br />
&nbsp;&nbsp;} finally {<br />
&nbsp;&nbsp;&nbsp;s.close();<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return null;</font></p>
<font face="Arial">
<p><br />
&nbsp;}</p>
<p>&nbsp;public void saveIcWsprice(String icProductline, IcWsprice icWsprice) {<br />
&nbsp;&nbsp;this.getHibernateTemplate()<br />
&nbsp;&nbsp;&nbsp;&nbsp;.saveOrUpdate(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProductlineUtils.getEntity(icProductline, &quot;wsprice&quot;),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;icWsprice);</p>
<p>&nbsp;}</p>
<p>&nbsp;public void updateIcWsprice(String icProductline, IcWsprice icWsprice) {<br />
&nbsp;&nbsp;this.getHibernateTemplate()<br />
&nbsp;&nbsp;&nbsp;&nbsp;.update(ProductlineUtils.getEntity(icProductline, &quot;wsprice&quot;),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;icWsprice);</p>
<p>&nbsp;}</p>
<p>&nbsp;public IcPgroup getIcArea(String icProductline, String icArea) {<br />
&nbsp;&nbsp;log.info(&quot;start search a IcPgroup&nbsp; exist ??&quot;);<br />
&nbsp;&nbsp;List list = this.getHibernateTemplate().find(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&quot;FROM &quot; + ProductlineUtils.getEntity(icProductline, &quot;pgroup&quot;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ &quot; p where p.icPgrp='&quot; + icArea + &quot;'&quot;);<br />
&nbsp;&nbsp;if (list != null &amp;&amp; list.size() &gt; 0) {<br />
&nbsp;&nbsp;&nbsp;log.info(&quot;IcPgroup exist&quot;);<br />
&nbsp;&nbsp;&nbsp;return (IcPgroup) list.get(0);<br />
&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;return null;<br />
&nbsp;}</p>
<p>&nbsp;public List getWpricingList(String icProductline, Map conditionMap,<br />
&nbsp;&nbsp;&nbsp;PageSeparator pageSeparator) {<br />
&nbsp;&nbsp;Calendar icEffDate = (Calendar) conditionMap.get(&quot;icEffDate&quot;);<br />
&nbsp;&nbsp;String icCode = (String) conditionMap.get(&quot;icCode&quot;);<br />
&nbsp;&nbsp;String icArea = (String) conditionMap.get(&quot;icArea&quot;);<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;String hql = &quot;select count(*) from &quot;+ProductlineUtils.getEntity(icProductline, &quot;wsprice&quot;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ &quot; p WHERE p.icCode LIKE ? AND p.icArea LIKE ? &quot;;<br />
&nbsp;&nbsp;if (icEffDate != null) {<br />
&nbsp;&nbsp;&nbsp;hql += &quot; AND p.icEffDate=?&quot;;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;Session s = this.getSession();<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;List list=null;<br />
&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;Query q = s.createQuery(hql);<br />
&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;q.setString(0, &quot;%&quot; + icCode + &quot;%&quot;);<br />
&nbsp;&nbsp;&nbsp;q.setString(1, &quot;%&quot; + icArea + &quot;%&quot;);<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;if (icEffDate != null) {<br />
&nbsp;&nbsp;&nbsp;q.setCalendar(2, icEffDate);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; list = q.list();<br />
&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;Iterator i = list.iterator();<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;log.debug(i);<br />
&nbsp;&nbsp;s.close();<br />
&nbsp;&nbsp;if (i.hasNext()) {<br />
&nbsp;&nbsp;&nbsp;pageSeparator.calculate(Integer.parseInt(i.next().toString()));<br />
&nbsp;&nbsp;&nbsp;log.info(pageSeparator);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;hql = &quot;FROM &quot; + ProductlineUtils.getEntity(icProductline, &quot;wsprice&quot;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;+ &quot; p WHERE p.icCode LIKE ? AND p.icArea LIKE ? &quot;;<br />
&nbsp;&nbsp;if (icEffDate != null) {<br />
&nbsp;&nbsp;&nbsp;hql += &quot; AND p.icEffDate=?&quot;;<br />
&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;hql += &quot; ORDER BY p.icEffDate DESC &quot;;</p>
<p>&nbsp;&nbsp;s = this.getSession();<br />
&nbsp;&nbsp;q = s.createQuery(hql);<br />
&nbsp;&nbsp;q.setString(0, &quot;%&quot; + icCode + &quot;%&quot;);<br />
&nbsp;&nbsp;q.setString(1, &quot;%&quot; + icArea + &quot;%&quot;);</p>
<p>&nbsp;&nbsp;if (icEffDate != null) {<br />
&nbsp;&nbsp;&nbsp;q.setCalendar(2, icEffDate);<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;q.setMaxResults(pageSeparator.getPageSize());<br />
&nbsp;&nbsp;q.setFirstResult(pageSeparator.getStartRecord());</p>
<p>&nbsp;&nbsp;list = q.list();<br />
&nbsp;<br />
&nbsp;&nbsp;} catch (Exception e) {<br />
&nbsp;&nbsp;&nbsp;System.out.println(e.getMessage());<br />
&nbsp;&nbsp;}finally{<br />
&nbsp;&nbsp;&nbsp;s.close();<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;return list;<br />
&nbsp;}<br />
}<br />
&nbsp;</p>
<p>本人实在不会解说,自己慢慢体会吧,不懂可以问我,chengxiaoyou2000@yahoo.com.cn</p>
</font></font></font>
          <br/>
          <span style="color:red;">
            <a href="http://skycxy.javaeye.com/blog/108537#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 03 Aug 2007 12:15:45 +0800</pubDate>
        <link>http://skycxy.javaeye.com/blog/108537</link>
        <guid>http://skycxy.javaeye.com/blog/108537</guid>
      </item>
      <item>
        <title>一个非常方便的struts国际化插件</title>
        <author>skycxy</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://skycxy.javaeye.com">skycxy</a>&nbsp;
          链接：<a href="http://skycxy.javaeye.com/blog/103132" style="color:red;">http://skycxy.javaeye.com/blog/103132</a>&nbsp;
          发表时间: 2007年07月20日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>下载该插件可以非常方便的实现各种编码间的转换</p>
<p>插件下载址：<a href="http://propedit.sourceforge.jp/eclipse/updates">http://propedit.sourceforge.jp/eclipse/updates</a></p>
<p>安装：用eclipse的helpe选项中的software update去下载即可。下载好了重启电脑。</p>
<p>我们现在就可以直接在eclipse中的资源文件中直接打我们需要的字体。</p>
<p>比如 简体：xxx_zh_CN.propertise文件中：nihao=你好</p>
<p>&nbsp;英文：xxx_ enpropertise文件中：nihao=hello;</p>
<p>繁体：xxx_zh_TW.propertise文件中：nihao=號碼</p>
<p>这样eclipse会自动的去转换成utf-8</p>
          <br/>
          <span style="color:red;">
            <a href="http://skycxy.javaeye.com/blog/103132#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 20 Jul 2007 10:50:24 +0800</pubDate>
        <link>http://skycxy.javaeye.com/blog/103132</link>
        <guid>http://skycxy.javaeye.com/blog/103132</guid>
      </item>
      <item>
        <title>一个实用的ajax模块访问数据库</title>
        <author>skycxy</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://skycxy.javaeye.com">skycxy</a>&nbsp;
          链接：<a href="http://skycxy.javaeye.com/blog/101626" style="color:red;">http://skycxy.javaeye.com/blog/101626</a>&nbsp;
          发表时间: 2007年07月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><font face="Arial">一个js：</font></p>
<p><font face="Arial">function XMLRequest(_m,_a)<br />
{<br />
&nbsp;&nbsp;&nbsp; var o=null;<br />
&nbsp;&nbsp;&nbsp; var x=new Object();<br />
&nbsp;&nbsp;&nbsp; var method=null;<br />
&nbsp;&nbsp;&nbsp; var args=null;<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; if(_m!=null)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method=_m;<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; if(_a!=null)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method=_a;<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; if(window.ActiveXObject)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; else if(window.XMLHttpRequest)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o=new XMLHttpRequest();<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; if(o!=null)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.onreadystatechange=function()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(o.readyState!=4)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(method!=null&amp;&amp;arguments!=null)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method.call(o,args);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new Error(&quot;Error:no callback proccessor.&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; x.setCallback=function(m,a)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method=m;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; args=a;<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; x.get=function(url,asy)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.open(&quot;GET&quot;,url,asy);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.send(null);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; x.post=function(url,package,asy)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.open(&quot;POST&quot;,url,asy);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.setRequestHeader(&quot;Content-Type&quot;,&quot;application/x-www-form-urlencoded;&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o.send(package);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; x.getCoreObject=function()<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return o;<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; return x;<br />
}</font></p>
<p><font face="Arial">一个页面：</font></p>
<p><font face="Arial"><script language="javascript"></font></p>
<p><font face="Arial"><font face="Arial">function inputIcShopid()<br />
{ <br />
 if(document.getElementById("icShopid").value!=""&&document.getElementById("icShopid").value.length>1)<br />
       {<br />
       try{ <br />
    var url="/ic/IC160_GetIcShopid.do?timeStamp="+new Date().getTime()<br />
    <br />
    var qs="icShopid="+document.getElementById("icShopid").value;<br />
    <br />
    var request=new XMLRequest();<br />
    <br />
    var array=new Array();<br />
    array[0]=request;<br />
    <br />
       request.setCallback(showIcShopid,array)<br />
    <br />
        request.post(url,qs); <br />
   <br />
   }catch (e)<br />
      {<br />
         </font></font></p>
<p><font face="Arial"><font face="Arial">         } <br />
                 <br />
}</font><br />
<font face="Arial">var showIcShopid = function(_args)<br />
{</font></font></p>
<p><font face="Arial"><font face="Arial">//这里根据自己 的需要写，也可不写<br />
}</font></font></p>
<p><font face="Arial"><font face="Arial"></script></font></p>
          <br/>
          <span style="color:red;">
            <a href="http://skycxy.javaeye.com/blog/101626#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 16 Jul 2007 17:43:41 +0800</pubDate>
        <link>http://skycxy.javaeye.com/blog/101626</link>
        <guid>http://skycxy.javaeye.com/blog/101626</guid>
      </item>
      <item>
        <title>用ajax实现HTML select功能</title>
        <author>skycxy</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://skycxy.javaeye.com">skycxy</a>&nbsp;
          链接：<a href="http://skycxy.javaeye.com/blog/101614" style="color:red;">http://skycxy.javaeye.com/blog/101614</a>&nbsp;
          发表时间: 2007年07月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p><font face="Arial"><span class="dark_c" style="FONT-WEIGHT: bold; FONT-SIZE: 14pt">用ajax实现HTML <select>功能</select>，从而达到动态从数据库中得到数据，而不要去修改jsp页面。代码：</span></font></p>
          <br/>
          <span style="color:red;">
            <a href="http://skycxy.javaeye.com/blog/101614#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 16 Jul 2007 17:09:59 +0800</pubDate>
        <link>http://skycxy.javaeye.com/blog/101614</link>
        <guid>http://skycxy.javaeye.com/blog/101614</guid>
      </item>
      <item>
        <title>struts 国际化</title>
        <author>skycxy</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://skycxy.javaeye.com">skycxy</a>&nbsp;
          链接：<a href="http://skycxy.javaeye.com/blog/101609" style="color:red;">http://skycxy.javaeye.com/blog/101609</a>&nbsp;
          发表时间: 2007年07月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <font face="Arial">
<p>1、Struts的国际化<br />
&nbsp;&nbsp;&nbsp; Struts是一种支持国际化的MVC的Web Framework。可是如何来使用struts国际化是一个问题。下面我们来探讨一下，如何实现Struts的国际化。Web程式的国际化涉及到3个层面的东西。第一、jsp部分的输入/输出；第二、应用处理程序的国际化；第三、DB的国际化问题。这里主要探讨的是jsp部分的输入/输出问题。</p>
<p>2、定义资源文件<br />
在/WEB-INF/classes下面添加UTF-8资源束文件。每一个资源文件是&ldquo;键－值&rdquo;对的集合。在JSP页面里面可以通过键来找到相应的数据值。本例子的文件名是ApplicationResources，所以相应的资源文件束是(包括e文，简体中文，繁体中文)<br />
ApplicationResources.properties : 默认资源文件。当在其他资源文件里面找不到某个资源的时候，就使用该资源文件里面的定义。<br />
ApplicationResources_zh_CN.properties：简体中文资源文件。<br />
ApplicationResources_zh_TW.properties：繁体中文资源文件。<br />
资源文件的格式为：默认资源文件名_国别_语言.properties。其中每个文件都是通过<font color="#660000">%JAVA_HONE%/BIN/native2ascii.exe</font>工具转换而来。你也可以使用其他工具来处理得到(<a href="http://java.sun.com/products/jilkit/">http://java.sun.com/products/jilkit/</a> 有一个工具Internationalization Java Internationalization and Localization Toolkit 可以处理)。下面是一个例子,我们显示如何使用%JAVA_HONE%/BIN/native2ascii.exe命令来定义资源束文件。</p>
<p>2.2 准备完成以后，使用如下的命令创建UTF-8资源文件束<br />
native2ascii -encoding gb2312 ApplicationResources_zh_CN.bak ApplicationResources_zh_CN.properties<br />
native2ascii -encoding big5 Applica tionResources_zh_TW.bak ApplicationResources_zh_TW.properties </p>
<p>注意： big5码必须在big5码的环境（即控制面板中的语言区域这个选项中选台湾即可）中去转化成UTF-8,否则转化不能 成功</p>
<p>3、定义JSP页面的字符集合<br />
定义JSP页面的语言为UTF-8。在每个JSP页面，必须有如下的内容（如果使用的模板技术，则只是需要在模板页面添加，其他使用该模板的页面无需添加）<br />
<!--page contentType="text/html;charset=UTF-8--></p>
<p>在struts-config.xml中的 <font face="Arial"><message-resources parameter="ApplicationResources"></message-resources>&nbsp;&nbsp;key=&quot;ic160&quot; /&gt;即可，struts框架会根据你 的 所在的区域自动选择资源文件。</font></p>
<p>对于表单数据的处理，我们是通过添加一个Filter来实现的。所有提交的请求，都需要做字符处理。然后在web.xml里面定义该Filter。这样我们就不需要在程序里面做任何的字符处理对于表单数据的处理，我们是通过添加一个Filter来实现的。所有提交的请求，都需要做字符处理。然后在web.xml里面定义该Filter。这样我们就不需要在程序里面做任何的字符处理</p>
<p>3.1 定义Filter。下面是一个例子。<br />
package com.webapps.commons; </p>
<p>import java.io.*;<br />
import javax.servlet.*;</p>
<p>public class CharsetEncodingFilter implements Filter{<br />
&nbsp; private FilterConfig config = null;<br />
&nbsp; private String defaultEncode = &quot;UTF-8&quot;;</p>
<p>&nbsp; public void init(FilterConfig config) throws ServletException {<br />
&nbsp;&nbsp;&nbsp; this.config = config;<br />
&nbsp;&nbsp;&nbsp; if(config.getInitParameter(&quot;Charset&quot;)!=null){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; defaultEncode=config.getInitParameter(&quot;Charset&quot;);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp; }</p>
<p>&nbsp; public void destroy() {<br />
&nbsp;&nbsp;&nbsp; this.config = null;<br />
&nbsp; }</p>
<p>&nbsp; public void doFilter(ServletRequest request, ServletResponse response,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FilterChain chain) throws IOException, ServletException {<br />
&nbsp;&nbsp;&nbsp; ServletRequest srequest=request;<br />
&nbsp;&nbsp;&nbsp; srequest.setCharacterEncoding(defaultEncode);<br />
&nbsp;&nbsp;&nbsp; chain.doFilter(srequest,response);<br />
&nbsp; }<br />
}</p>
<p>3.2 在web.xml里面声明使用该Filter<br />
<filter></filter><br />
&nbsp; <filter-name></filter-name>Character Encoding<br />
&nbsp; <filter-class></filter-class>com.webapps.commons.CharsetEncodingFilter<br />
<br />
<filter-mapping></filter-mapping><br />
&nbsp; <filter-name></filter-name>Character Encoding<br />
&nbsp; <url-pattern></url-pattern>/*<br />
</p>
<p>4 用户在web浏览器根据自身要求选择语言</p>
<p>在action中：</p>
<p>//定义一个<font face="Arial">Locale 对象，从页面请求中获得用户选择语言的信息</font></p>
<p><font face="Arial">Locale locale = new Locale(request.getParameter(&quot;locale&quot;))；</font></p>
<p><font face="Arial">/把locale保存在session中<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; request.getSession().setAttribute(Globals.LOCALE_KEY,locale);</font></p>
<p>这样就可以了 实现国际化了 </p>
<p><font face="Arial">&nbsp;&nbsp;<br />
&nbsp;</font></p>
<p><br />
<br />
&nbsp;</p>
</font>
          <br/>
          <span style="color:red;">
            <a href="http://skycxy.javaeye.com/blog/101609#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 16 Jul 2007 17:01:57 +0800</pubDate>
        <link>http://skycxy.javaeye.com/blog/101609</link>
        <guid>http://skycxy.javaeye.com/blog/101609</guid>
      </item>
      <item>
        <title>JS中事件和事件处理</title>
        <author>skycxy</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://skycxy.javaeye.com">skycxy</a>&nbsp;
          链接：<a href="http://skycxy.javaeye.com/blog/95573" style="color:red;">http://skycxy.javaeye.com/blog/95573</a>&nbsp;
          发表时间: 2007年06月29日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center"><font size="3"><span lang="EN-US"><font face="Times New Roman">JS</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中事件和事件处理</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">一、事件处理程序：</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span><span lang="EN-US"><font face="Times New Roman">0</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级中可以这样定义：</span><span lang="EN-US"><font face="Times New Roman">document.fromName..name.onclick=function(){};</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数事件</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 5.25pt; mso-char-indent-count: .5"><font size="3"><span lang="EN-US"><font face="Times New Roman"><span style="mso-spacerun: yes">&nbsp;</span><span style="mso-spacerun: yes">&nbsp;</span></font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级时间模型中，可以调用对象的</span><span lang="EN-US" style="COLOR: red"><font face="Times New Roman">addEventListener()</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法为特定元素注册事件处理程序。这个方法有<span style="COLOR: red">三个参数</span>。第一个参数是要注册处理程序的事件类型名。事件类型应该是喊有小写</span><span lang="EN-US" style="COLOR: red"><font face="Times New Roman">HTML</font></span><span style="COLOR: red; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">处理程序性质名的字符串</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，没有前缀</span><span lang="EN-US" style="COLOR: red"><font face="Times New Roman">&rdquo;on&rdquo;,</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如在</span><span lang="EN-US"><font face="Times New Roman">html</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中性质</span><span lang="EN-US"><font face="Times New Roman">onclick</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，在</span><span lang="EN-US"><font face="Times New Roman">0</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级模型中用</span><span lang="EN-US" style="COLOR: red"><font face="Times New Roman">onclick</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性，而在</span><span lang="EN-US"><font face="Times New Roman">2</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级事件模型中就用字符串&ldquo;</span><span lang="EN-US" style="COLOR: red"><font face="Times New Roman">click</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">&rdquo;。</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-spacerun: yes"><font face="Times New Roman">&nbsp;&nbsp; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二个参数是处理函数（或监听者），在指定类型的事件发生时调用该函数。</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第三个参数是一个</span><span lang="EN-US"><font face="Times New Roman">boolean</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，如果值为</span><span lang="EN-US"><font face="Times New Roman">true</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，则指定的事件处理程序将在事件传播的捕捉阶段用于捕捉事件。如果值为</span><span lang="EN-US"><font face="Times New Roman">false</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，则事件处理程序就是常规的，当事件直接发生在对象上，或发生在元素的子女上，又向上起泡到该元素时，该处理程序将触发。</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例如，用</span><span lang="EN-US"><font face="Times New Roman">addEventListener()</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，为</span><span lang="EN-US"><font face="Times New Roman">
<form>
</form>
</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">元素的提交事件注册一个处理程序：</span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: red"><font size="3"><font face="Times New Roman">Document.myform..addEventListener(&ldquo;submit&rdquo;,function(e){<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt"><span lang="EN-US" style="COLOR: red"><font size="3" face="Times New Roman">Validate(e.target);</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt; TEXT-INDENT: 21pt"><span lang="EN-US"><font size="3" face="Times New Roman">}; <span style="COLOR: fuchsia">false</span>)</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-spacerun: yes"><font face="Times New Roman">&nbsp;</font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果想捕捉</span><span lang="EN-US"><font face="Times New Roman"> </font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">元素中发生的所有</span><span lang="EN-US"><font face="Times New Roman">mousedown</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件，可以使用如下</span><span lang="EN-US"><font face="Times New Roman"> addEventListener()</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法：</span></font><span lang="EN-US"><font size="3"><font face="Times New Roman"><span style="COLOR: red">var mydiv=document.getElementById(&ldquo;mydiv&rdquo;);<o:p></o:p></span></font></font></span></p>
<div></div>
<div><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">&nbsp;&nbsp; </span></div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><font face="Times New Roman"><span lang="EN-US" style="COLOR: red"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>mydiv.addEventListener(&ldquo;mousedown&rdquo;,hadleMouseDown,</span><span lang="EN-US" style="COLOR: fuchsia">true</span><span lang="EN-US" style="COLOR: red">);<o:p></o:p></span></font></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">addEventListener()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法配对的是</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">removeEventListener()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，它的</span><span style="COLOR: black"><font face="Times New Roman"> </font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三个参数与前者相同。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><o:p><font size="3" face="Times New Roman"></font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">二、</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">0</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级事件模型中，在函数中，关键字</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">this</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引用的就是发生事件的元素。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级事件模型中，不应该依赖事件处理函数中的关键字</span><span lang="EN-US" style="COLOR: fuchsia"><font face="Times New Roman">this</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，而应该使用传递给处理函数的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">EVENT</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的属性</span><font face="Times New Roman"><span lang="EN-US" style="COLOR: fuchsia">currentTarget</span><span lang="EN-US" style="COLOR: black">. currentTarget</span></font><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性引用一个对象，该对象注册了当前的事件处理程序，而且是可以移植的方式注册的。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font size="3" face="Times New Roman"></font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><font size="3">三、把对象注册为事件处理程序：</font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件处理程序是实现了</span><span lang="EN-US"><font face="Times New Roman">eventListener </font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口和</span><span lang="EN-US"><font face="Times New Roman">handleEvent ()</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法的对象，</span><span lang="EN-US"><font face="Times New Roman">DOM API</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span><span lang="EN-US"><font face="Times New Roman">javascript</font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">规约不要求实现</span><span lang="EN-US"><font face="Times New Roman">eventListener </font></span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口，而只允许给</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">addEventListener()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法直接传递函数引用，如果想用对象作为事件处理程序，那么可以使用如下方式来注册他们：</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">Function registerObjectEventHandler( elenment,eventtype,listener,captures){<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Element.addEventListener(eventtype,<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 125.25pt; TEXT-INDENT: 21.75pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">Function(event){listener.handleEvent(event);}</font></font></span><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">,captures);<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 146.25pt; TEXT-INDENT: 21.75pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">}<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用这个函数可以把任何对象注册为事件处理程序，只要它定义了</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">handleEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（）方法。该方法作为监听程序对象的方法而调用，关键字</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">this </font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引用的是监听程序对象而不是生成事件的文档元素。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><o:p><font size="3" face="Times New Roman"></font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">四、事件模型和事件类型：</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font></font></span><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">DOM</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">没有标准化任何类型的键盘事件！！</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><o:p></o:p></font></font></span></p>
<div>
<table class="MsoTableGrid" cellspacing="0" border="1" cellpadding="0" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext">
    <tbody>
        <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 142pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模块名</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件接口</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件类型</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 1">
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 142pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">HTMLEvents<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">Event<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">abort,blur,change,error,focus,load,reset,resize,<o:p></o:p></font></font></span></p>
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">scroll,select,submit,unload<o:p></o:p></font></font></span></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 2">
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 142pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">MouseEvents<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">MouseEvent<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">Click,mousedown,mousemove,mouseout,<o:p></o:p></font></font></span></p>
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">mouseover,mouseup<o:p></o:p></font></font></span></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 3">
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 142pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">UIEvents<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">UIEvent<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">DOMActivate,DOMFocusIn,DOMFocusOut<o:p></o:p></font></font></span></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 4; mso-yfti-lastrow: yes">
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 142pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">MutationEvents<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">MutationEvent<o:p></o:p></font></font></span></p>
            </td>
            <td valign="top" width="189" style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ece9d8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ece9d8; WIDTH: 142.05pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt">
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">DOMAttrModified,DOMCharacterDataModified<o:p></o:p></font></font></span></p>
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">DOMNodeInserted,DOMNodeInsertedIntoDocument<o:p></o:p></font></font></span></p>
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">DOMNodeRemoved,DOMNodeRemovedFromDocument<o:p></o:p></font></font></span></p>
            <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">DOMSubtreeModified<o:p></o:p></font></font></span></p>
            </td>
        </tr>
    </tbody>
</table>
</div>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这四个接口构成一个层次。</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口是这个层次的根，</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">UIEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的子接口，</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">MouseEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">UIEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的子接口，</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">MutationEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口的子接口</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><o:p><font size="3" face="Times New Roman"></font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Evnet</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口定义的属性：</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>type<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生的事件的类型，该属性的值是事件类型名，与注册事件处理程序是使用的字符串值相同（如：&ldquo;</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"> click</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">&rdquo;）</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">.<o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>target<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生事件的节点，可能与</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"> currentTarget</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不同。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>eventPhase <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个数字，指定了当前所处的事件传播过程的阶段。它的值是常量，可能值包括</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event.CAPTURING_PHASE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event.AT_TARGET</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman">Event.BUBBLING_PHASE.<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>currentTarget <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生当前正在处理的事件的节点。如果在传播过程的捕捉阶段或起泡阶段处理事件，这个属性的值就与</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">target</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性的值不同</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>timeStamp <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Date</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象，声明事件何时发生</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>bubbles <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个布尔值，声明该事件是否在文档树中起泡。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>cancelable <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个布尔值，声明该事件是否具有能用</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">preventDefault()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法取消默认动作</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Evnet</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口还定义了</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个方法：</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"> stopPropagation() </font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">preventDefault().<o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">调用</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">stopPropagation()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法可以阻止事件从当前正在处理它的节点传播。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 1"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">调用</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">preventDefault()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法阻止浏览器执行与事件相关的默认动作。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><o:p><font size="3" face="Times New Roman">&nbsp;</font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">UIEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接口还定义</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个的属性：</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>view <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-spacerun: yes"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">发生事件的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Window</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象（在</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">DOM</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">术语中称为&ldquo;视图&rdquo;）</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>detail<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 6pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个数字，提供时间的额外信息，对于</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">click</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">mousedown</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件和</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">mouseup</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件，这个字段代表点击的次数。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">MouseEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">UIEvent</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的子接口，它还定义了下列属性：</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>button<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个数字，声明在</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">click</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">mousedown</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件和</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">mouseup</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件中，哪个鼠标键改变了状态。值为</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">0</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示左键，值为</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">1</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示中间键，值为</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">3</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示右键，这个</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 63pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性只在鼠标键状态改变时用</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>altKey</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">ctrKey</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">metaKey</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">shiftKey <o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这四个布尔值声明在鼠标事件发生时，是否按住了</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Alt</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">键、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Ctr</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">键、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Meta</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">键或</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Shift</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">键。与</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">button</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性不同，这些键盘属性对任何鼠标事件类型都有效。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>clientX</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">clientY <o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个属性声明鼠标指针相对于客户区或浏览器窗口的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">X</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">坐标和</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Y</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">坐标</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>screenX</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">screenY<span style="mso-spacerun: yes">&nbsp; </span><o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个属性声明鼠标指针相对于浏览器窗口左上角的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">X</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">坐标和</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Y</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">坐标</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>relatedTarget <o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><span style="mso-tab-count: 3"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">该属性引用与事件的目标节点相关的节点。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><o:p><font size="3" face="Times New Roman"></font></o:p></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">五、</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">IE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>IE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的事件起泡：</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">IE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件模型没有</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">DOM</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模型具有的事件捕捉概念，事件可以</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">沿着包容层次向上起泡。</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">IE Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象没有</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">DOM Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象具有的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">stopPropagation()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，所以要阻止事件起泡或者进一步传播，</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">IE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件处理程序必须把</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">cancekBubble</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性设为</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">true</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">window.event.cancelBubble=true<o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意：设置</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">cancelBubble</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性只适用于当前事件，当新事件生成时，将赋予</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">window.event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新的</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">Event</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象，</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">cancelBubble</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">属性将还原为它的默认值</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">false</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>IE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件处理程序的注册，由于</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">IE</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件模型不支持事件捕捉，所以它只有</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个参数，即事件类型和处理函数。可以用</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">attachEvent()</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法注册事件处理程序：</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>fuction<span style="mso-spacerun: yes">&nbsp; </span>f(e){&hellip;}<o:p></o:p></font></font></span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span lang="EN-US" style="COLOR: black"><font size="3"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>document.getElementById(&ldquo;myelt&rdquo;).attachEvent(&ldquo;onmouserover&rdquo;,f)</font></font></span></p>
<span lang="EN-US" style="COLOR: black">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">//</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要让事件进一步传播</span><span lang="EN-US" style="COLOR: black"><o:p></o:p></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: black"><font face="Times New Roman"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>If(e.stopPropageation)e. stopPropageation();//2</font></span><span style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">级</span><span lang="EN-US" style="COLOR: black"><font face="Times New Roman">DOM<o:p></o:p></font></span></font></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">&lt;span lang=&quot;EN-US&quot; sty</p></span>
          <br/>
          <span style="color:red;">
            <a href="http://skycxy.javaeye.com/blog/95573#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 29 Jun 2007 16:35:17 +0800</pubDate>
        <link>http://skycxy.javaeye.com/blog/95573</link>
        <guid>http://skycxy.javaeye.com/blog/95573</guid>
      </item>
  </channel>
</rss>