<script>
function init(form)
{
for(var m=0;m<myform.elements.length;m++){
var ob=myform.elements[m];
if(ob.type=="radio"){
ob.onfocus=new Function("nextfocus(this)");
}
}
}function nextfocus(obj)
{
document.all(obj.sourceIndex+1).focus();
}
</script>
<body onload=init()>
<form name=myform>
<input type=checkbox id=mycheck>
<input type=radio name=myradio checked value=1>text
<input type=radio name=myradio value=2>checkbox
<input type=radio name=myradio value=3>select
<input type=text id=mytext>
<select id=mysel>
<option>1
<option>2
</select>
</form>

解决方案 »

  1.   

    W3 DOMobjectID.nextSibling.focus()
      

  2.   

    function init()
    {
        e = event.srcElement;
        if(e.type=="RADIO")
        {
             e.focus();
        }
    }
      

  3.   

    谢谢大家的捧场了,我的意思是说一排html控件其中有radiobutton控件,按回车键后焦点从一个控件上移倒下一个控件,但如果下一个控件是radiobutton的话,焦点会自动跳过这个控件而移到它的下面那个控件上。弄了半天没弄出来,请大家执教.
      

  4.   

    <script>
    function init(form)
    {
    for(var m=0;m<myform.elements.length;m++){
    var ob=myform.elements[m];
    ob.onkeydown=new Function("checkkey(this)");
    if(ob.type=="radio"){
    ob.onfocus=new Function("nextfocus(this)");
    }
    }
    }function checkkey(obj)
    {
    if(event.keyCode==13)
    nextfocus(obj);
    }function nextfocus(obj)
    {
    document.all(obj.sourceIndex+1).focus();
    }
    </script>
    <body onload=init()>
    <form name=myform>
    <input type=text id=mytext>
    <input type=text id=mytext2>
    <input type=checkbox id=mycheck>
    <input type=radio name=myradio checked value=1>text
    <input type=radio name=myradio value=2>checkbox
    <input type=radio name=myradio value=3>select
    <input type=text id=mytext3>
    <select id=mysel>
    <option>1
    <option>2
    </select>
    </form>