页面上是个RadioButtonList以下代码放到Page_Load里面。想给RadioButtonList项的点击加上脚本的。rdlFormat.Items[0].Attributes.Add("onclick", "witchtype('TypePic')") ;
rdlFormat.Items[1].Attributes.Add("onclick", "switchtype('TypeWord')") ;
rdlFormat.Items[1].Attributes.Add("onclick", "switchtype('TypeWord')") ;
<script language="javascript">
function changetype()
{
if (rdlFormat_0.checked)
{
witchtype('TypePic');
}
if (rdlFormat_1.checked)
{
switchtype('TypeWord');
}
}