这样可以吧!<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <input type="text" value=""  name="test" id="test"/>
            <br />
            <a href="javascript:void(0)" onclick="setValue(this)">123</a>
            <a  href="javascript:void(0)" onclick="setValue(this)">234</a>
            <a  href="javascript:void(0)" onclick="setValue(this)">456</a>
            <a  href="javascript:void(0)" onclick="setValue(this)">789</a>
        </div>
    </form>
</body>
<script type="text/javascript" language="javascript">
var currentCount=0;
function setValue(obj)
{
    currentCount++;
    if(currentCount >= 7)
    {
        alert("最多只能选择6个");
        return;
    }
    document.getElementById("test").value=document.getElementById("test").value+obj.innerHTML+" ";
}
</script>
</html>