<form name="form1" method="post" action="">
<p> (1)
<input type="radio" name="s1" value="radiobutton">
<input type="text" name="d1" onkeydown="test(this)">
</p>
<p> (2)
<input type="radio" name="s2" value="radiobutton">
<input type="text" name="d2" onkeydown="test(this)">
</p>
<p> (3)
<input type="radio" name="s3" value="radiobutton">
<input type="text" name="d3" onkeydown="test(this)">
</p>
<p> (4)
<input type="radio" name="s4" value="radiobutton">
<input type="text" name="d4" onkeydown="test(this)">
</p>
<p> (5)
<input type="radio" name="s5" value="radiobutton">
<input type="text" name="d5" onkeydown="test(this)">
</p>
</form>
<script>
function test(obj)
{
switch(window.event.keyCode)
{
case 49:
obj.value="优"
obj.style.color='#000000'
event.returnValue=false
break;
case 50:
obj.value="良"
obj.style.color='#000000'
event.returnValue=false
break;
case 51:
obj.value="中"
obj.style.color='#000000'
event.returnValue=false
break;
case 52:
obj.value="及格"
obj.style.color='#000000'
event.returnValue=false
break;
case 53:
obj.value="不及格"
obj.style.color='red'
event.returnValue=false
break;
default:
event.returnValue=false
break;
}
if(event.keyCode == 38)
{
var id = window.event.srcElement.name
id = id.substr(1,1)
id = parseInt(id) - 1
if(id < 1) id = 5
eval("document.form1.d" + id + ".focus()")
}
if(event.keyCode == 40)
{
var id = window.event.srcElement.name
id = id.substr(1,1)
id = parseInt(id) + 1
if(id > 5) id = 1
eval("document.form1.d" + id + ".focus()")
}}
</script>
<form name="form1" method="post" action="">
<p> (1)
<input type="radio" name="s1" value="radiobutton">
<input type="text" name="d1" onkeydown="test(this)">
</p>
<p> (2)
<input type="radio" name="s2" value="radiobutton">
<input type="text" name="d2" onkeydown="test(this)">
</p>
<p> (3)
<input type="radio" name="s3" value="radiobutton">
<input type="text" name="d3" onkeydown="test(this)">
</p>
<p> (4)
<input type="radio" name="s4" value="radiobutton">
<input type="text" name="d4" onkeydown="test(this)">
</p>
<p> (5)
<input type="radio" name="s5" value="radiobutton">
<input type="text" name="d5" onkeydown="test(this)">
</p>
</form>
<script>
function test(obj)
{
switch(window.event.keyCode)
{
case 49:
obj.value="优"
obj.style.color='#000000'
event.returnValue=false
break;
case 50:
obj.value="良"
obj.style.color='#000000'
event.returnValue=false
break;
case 51:
obj.value="中"
obj.style.color='#000000'
event.returnValue=false
break;
case 52:
obj.value="及格"
obj.style.color='#000000'
event.returnValue=false
break;
case 53:
obj.value="不及格"
obj.style.color='red'
event.returnValue=false
break;
default:
event.returnValue=false
break;
}
if(event.keyCode == 38)
{
var id = window.event.srcElement.name
id = id.substr(1,1)
id = parseInt(id) - 1
if(id < 1) id = 5
eval("document.form1.d" + id + ".focus()")
}
if(event.keyCode == 40)
{
var id = window.event.srcElement.name
id = id.substr(1,1)
id = parseInt(id) + 1
if(id > 5) id = 1
eval("document.form1.d" + id + ".focus()")
}}
</script>
<p> (1)
<input type="radio" name="s1" value="radiobutton">
<input type="text" name="d1" onkeydown="test(this)">
</p>
<p> (2)
<input type="radio" name="s2" value="radiobutton">
<input type="text" name="d2" onkeydown="test(this)">
</p>
<p> (3)
<input type="radio" name="s3" value="radiobutton">
<input type="text" name="d3" onkeydown="test(this)">
</p>
<p> (4)
<input type="radio" name="s4" value="radiobutton">
<input type="text" name="d4" onkeydown="test(this)">
</p>
<p> (5)
<input type="radio" name="s5" value="radiobutton">
<input type="text" name="d5" onkeydown="test(this)">
</p>
</form>
<script>
function test(obj)
{
switch(window.event.keyCode)
{
case 49:
obj.value="优"
obj.style.color='#000000'
obj.style.fontWeight='normal'
event.returnValue=false
break;
case 50:
obj.value="良"
obj.style.color='#000000'
obj.style.fontWeight='normal'
event.returnValue=false
break;
case 51:
obj.value="中"
obj.style.color='#000000'
obj.style.fontWeight='normal'
event.returnValue=false
break;
case 52:
obj.value="及格"
obj.style.color='#000000'
obj.style.fontWeight='normal'
event.returnValue=false
break;
case 53:
obj.value="不及格"
obj.style.color='red'
obj.style.fontWeight='bold'
event.returnValue=false
break;
default:
event.returnValue=false
break;
}
if(event.keyCode == 38)
{
var id = window.event.srcElement.name
id = id.substr(1,1)
id = parseInt(id) - 1
if(id < 1) id = 5
eval("document.form1.d" + id + ".focus()")
}
if(event.keyCode == 40)
{
var id = window.event.srcElement.name
id = id.substr(1,1)
id = parseInt(id) + 1
if(id > 5) id = 1
eval("document.form1.d" + id + ".focus()")
}}
</script>