<input id=mm readOnly>
<input type=button value=empty onclick="document.all.mm.vlaue=''">
<input type=button value=a onclick="meizz('a')">
<input type=button value=b onclick="meizz('b')">
<input type=button value=c onclick="meizz('c')">
<SCRIPT LANGUAGE="JavaScript">
function meizz(str)
{
  var s = document.all.mm.value;
  if (!new RegExp("(^|\/)"+ str +"(\/|$)").test(s))
  mm.value = s=="" ? str : s +"/"+ str;
}
</SCRIPT>

解决方案 »

  1.   

    <input id="demo"/>
    <input type="button" value="a" onclick="fo(this.value)"/>
    <input type="button" value="b" onclick="fo(this.value)"/>
    <input type="button" value="c" onclick="fo(this.value)"/>
    <script language="JavaScript">
    <!--
    var d=[],dd=[];
    function fo(s) {
    if(!d[s]){
    dd[dd.length]=s;
    d[s]=s;
    document.getElementById("demo").value=dd.join("/");
    }
    }
    //-->
    </script>
      

  2.   

    看不懂啊,这两句啥意思啊if (!new RegExp("(^|\/)"+ str +"(\/|$)").test(s))
      mm.value = s=="" ? str : s +"/"+ str;
      

  3.   

    这个如何<input id=mm readOnly>
    <input type=button value=empty onclick="myfun('')">
    <input type=button name='a' value=a onclick="myfun('a',this)">
    <input type=button name='b' value=b onclick="myfun('b',this)">
    <input type=button name='c' value=c onclick="myfun('c',this)">
    <SCRIPT LANGUAGE="JavaScript">
    function myfun(str,obj)
    {
      var s = document.all.mm.value;
      if(str==''){
        mm.value="";
        document.all.a.disabled = false;
        document.all.b.disabled = false;
        document.all.c.disabled = false;
      }else{  
        mm.value = s=="" ? str : s +"/"+ str;
        obj.disabled=true;
      }
    }
    </SCRIPT>