<?xml version="1.0"  encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="gb2312" omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/> <xsl:template match="/"><table width="600"  border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<input type="radio" name="radio" checked="checked" value="public" onclick="testClass.show(this)" />public
&#160;
<input type="radio" name="radio" value="private" onclick="testClass.show(this)" />private
</td>
</tr>
<tr>
<td>
<div id="publicDiv">public</div>
<div id="privateDiv" style="display:none">private</div>
</td>
</tr>

<script type="text/javascript" defer="true">
<xsl:comment>
<![CDATA[
if(typeof testClass == 'undefined'){
var testClass = {
,show : function(obj){
if(obj.value == 'private'){
document.getElementById('publicDiv').style.display = 'none';
document.getElementById('privateDiv').style.display = '';
}else {
document.getElementById('privateDiv').style.display = 'none';
document.getElementById('publicDiv').style.display = '';
}
}
}
}
]]>
</xsl:comment>
</script>
</table>
</xsl:template>
</xsl:stylesheet>

解决方案 »

  1.   

    <table border="1">
    <tr>
    <td><input type="radio" name="radio" checked="checked" value="public" onclick="test(this.value)" />public</td>
    <td><input type="radio" name="radio" value="private" onclick="test(this.value)" />private</td>
    </tr>
    <tr>
    <td><div id="publicDiv" style="display:block">public</div>
    <td><div id="privateDiv" style="display:none">private</div>
    </tr>
    </table>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function test(param1)
    {
        if (param1 == 'private')
        {
        document.getElementById('privateDiv').style.display = 'block';
            document.getElementById('publicDiv').style.display = 'none';
        }
    else
    {
        document.getElementById('privateDiv').style.display = 'none';
            document.getElementById('publicDiv').style.display = 'block';
    }
       
    }
    //-->
    </SCRIPT>