缺少".缺少this
改成这样: document.write ("<body>")
document.write ("<table width='150' border='0' cellspacing='1' cellpadding='1' bgcolor='#6699CC'>")
document.write ("<tr> ")
document.write ("<td bgcolor='#F1F1F1' align='center'>")
document.write ("<span onClick='toggle(\"document.all.a\");' style='cursor:hand'>")
document.write ("<font color='#003399' onMouseOver='this.style.color=\"#FF3300\"' onMouseOut='this.style.color=\"#003399\"'> 菜单,点我</font>")
document.write ("</span>")
document.write ("</td>")
document.write ("</tr>")
document.write ("<tr> ")
document.write ("<td bgcolor='#F1F1F1' align='center'> ")
document.write ("<table width='100' border='0' cellspacing='0' cellpadding='2' align='right' id=a style='display:none'>")
document.write ("<tr> ")
document.write ("<td> 子菜单 一</td>")
document.write ("</tr>")
document.write ("<tr> ")
document.write ("<td> 子菜单 二</td>")
document.write ("</tr>")
document.write ("</table>")
document.write ("</td>")
document.write ("</tr>")
document.write ("</table>")你的function toggle(navID也必须写到write里才能有效果
改成这样: document.write ("<body>")
document.write ("<table width='150' border='0' cellspacing='1' cellpadding='1' bgcolor='#6699CC'>")
document.write ("<tr> ")
document.write ("<td bgcolor='#F1F1F1' align='center'>")
document.write ("<span onClick='toggle(\"document.all.a\");' style='cursor:hand'>")
document.write ("<font color='#003399' onMouseOver='this.style.color=\"#FF3300\"' onMouseOut='this.style.color=\"#003399\"'> 菜单,点我</font>")
document.write ("</span>")
document.write ("</td>")
document.write ("</tr>")
document.write ("<tr> ")
document.write ("<td bgcolor='#F1F1F1' align='center'> ")
document.write ("<table width='100' border='0' cellspacing='0' cellpadding='2' align='right' id=a style='display:none'>")
document.write ("<tr> ")
document.write ("<td> 子菜单 一</td>")
document.write ("</tr>")
document.write ("<tr> ")
document.write ("<td> 子菜单 二</td>")
document.write ("</tr>")
document.write ("</table>")
document.write ("</td>")
document.write ("</tr>")
document.write ("</table>")你的function toggle(navID也必须写到write里才能有效果
谢谢你的回复。