<chxml>
    <content>
        <type>AAA</type>
        <type>BBB</type>
        <type>CCC</type>
       </content>
</chxml>
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:copyRight="http://xml.sz.luohuedu.net/"  version="1.0">
<xsl:variable name="cols" select="3"/>
  <xsl:template match="chxml">
     <xsl:apply-templates select="content"/>
  </xsl:template>
  <xsl:template match="chxml/content">
   <a><xsl:attribute name="href" /><xsl:apply-templates select="type"/></a>
  </xsl:template>
</xsl:stylesheet>
<script type="text/javascript">
window.onload=function(){
var as=document.getElementsByTagName("a");
for(var i=0;i<as.length;i++){
as[i].onclick=function(){
switch(this.innerTHML){    ----->这句话在IE和火狐下全不好用
case "A":
   alert("AAA");
   break;
case "B":
  alert("BBB");
  break;
}
}
}
}
</script>获得被点击的链接名,反回一个值进行判断!!!!可是这个程序有点错误,麻烦各位高手给改改!!!

解决方案 »

  1.   

    <chxml>
        <content>
            <type>AAA</type>
            <type>BBB</type>
            <type>CCC</type>
           </content>
    </chxml>
    <?xml version="1.0" encoding="gb2312"?>
    <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:copyRight="http://xml.sz.luohuedu.net/"  version="1.0">
    <xsl:variable name="cols" select="3"/>
      <xsl:template match="chxml">
         <xsl:apply-templates select="content"/>
      </xsl:template>
      <xsl:template match="chxml/content">
       <a><xsl:attribute name="href" /><xsl:apply-templates select="type"/></a>
      </xsl:template>
    </xsl:stylesheet>
    <script type="text/javascript">
    window.onload=function(){
    var as=document.getElementsByTagName("a");
    for(var i=0;i<as.length;i++){
    as[i].onclick=function(){
    switch(this.innerTHML){    ----->这句话在IE和火狐下全不好用
    //*
    case "A":
       alert("AAA");
       break;
    case "B":
      alert("BBB");
      break;*//这块应该怎么进行判断啊
    }
    }
    }
    }
    </script>获得被点击的链接名,反回一个值进行判断!!!!可是这个程序有点错误,麻烦各位高手给改改!!!