Gridview中某一列绑定了DropDownlist,
DropDownlist中的值有:
1:优
2: 良
3:中当光标落到该DropDownlist上面时,键盘按下1,DropDownlist自动选择:优
键盘按下2,DropDownlist自动选择:良
键盘按下3,DropDownlist自动选择:中拜托各位大侠多多帮忙啊
DropDownlist中的值有:
1:优
2: 良
3:中当光标落到该DropDownlist上面时,键盘按下1,DropDownlist自动选择:优
键盘按下2,DropDownlist自动选择:良
键盘按下3,DropDownlist自动选择:中拜托各位大侠多多帮忙啊
<asp:DropDownList onkeydown="test(this)" ID="DropDownList1" runat="server">
<asp:ListItem Value="0">中</asp:ListItem>
<asp:ListItem Value="2">良</asp:ListItem>
<asp:ListItem Value="1">优</asp:ListItem>
</asp:DropDownList>
</form>
</body>
<script type="text/javascript">
function test(obj)
{
if(event.keyCode==49)
obj.value=1;
if(event.keyCode==50)
obj.value=2;
if(event.keyCode==51)
obj.value=0;
}
event.keyCode
function test(ddl)
{ if (ddl.selectedIndex == 0)
ddl.options[1].selected = true;
else
ddl.options[0].selected = true;
ddl.onchange();
}
function toSelect(obj){
if(obj && window.event){
var code = window.event.keyCode;
obj.value = code>48 ? code-48 : -1; //数字1的code为49,-1为指定的默认值
}
}
未测