我的web窗体有四个控件!
DropDownList1          TabIndex的值:0
DropDownList2          TabIndex的值:1
TextBox1               TabIndex的值:2
TextBox2               TabIndex的值:3
这样为什么当焦点在DropDownList1 上时,按TAB键,焦点却跑到IE的地址栏上去了!应该是在DropDownList2上啊!还有,我能不能用回车控制焦点啊!

解决方案 »

  1.   

    在DropDownList1中加 onkeydown="if(event.keyCode==13){JavaScript:accept(DropDownList2)}"
    function accept(nam)
    {
      obj=document.getElementById(nam);
      focus(obj);
    }
      

  2.   

    "这样为什么当焦点在DropDownList1 上时,按TAB键,焦点却跑到IE的地址栏上去了!"
    因为IE的默认TabIndex也是0,你放入页面的所有控件也默认是0,如果都是0,就会按你放入页面中的顺序来执行了。
    你把你的控件TabIndex设成如下:
    DropDownList1          TabIndex的值:1
    DropDownList2          TabIndex的值:2
    TextBox1               TabIndex的值:3
    TextBox2               TabIndex的值:4焦点在DropDownList1 上时,按TAB键就会到DropDownList2 了至于回车当TAB用。网上N多。一楼的
      

  3.   

    一楼的是不行,关键是DropDownList1没有属性