<html>
<head>
</head>
<body>
<input type="radio" id="r1" name="line1"> 5<br>
<input type="radio" id="r2" name="line1"> 10<br>
<input type="radio" id="r3" name="line1"> 20<br>
<input type="radio" id="r4" name="line1"> 50<br>
<input type="radio" id="r5" name="line1"> 100<br>
<input type="text" name="quantity" size="2" value="1" />
<script>
inputs=document.getElementsByName("line1")
q=document.getElementsByName("quantity")[0]
f=function(){q.value=this.nextSibling.wholeText}
;[].forEach.call(inputs, function(el){el.onchange=f})
</script>
</body>
</html>