如何用Javascript控制textbox的輸入法﹖(在線等待......)
例如﹕在用拼音輸入法時﹐所輸入的結果都是英文字母而不是漢字
我知道在VB.NET可以用textbox.style("ime-Mode")="disabled"
不知道用Javascript怎么控制﹐請各位大俠指教!!!!!!!!!

解决方案 »

  1.   

    其他方式的控制也可以﹐不過最好還是要Javascript控制輸入法﹐尤其是拼音輸入法
      

  2.   

    <script>
    function IME_Mode()
    {
    document.all["txt_test"].style.cssText="ime-mode:disabled;";
    }
    </script>
    <body onload="IME_Mode();"><input id="txt_test"></body>
      

  3.   

    Syntax: element { ime-mode: value }
    elementID.style.imeMode = "value" 
    document.all.elementID.style.imeMode = "value"  
     Values: auto, active, inactive, and disabled. Example: <input id="myInput" type="text" size=60 value='This input control has ime-mode 
    property set to "inactive"'>
    <button onclick="myInput.style.imeMode='active'">Set imeMode property to active</ 
    button>
    <button onclick="myInput.style.imeMode='inactive'">Set imeMode property to 
    inactive</button>
      

  4.   

    <input style="ime-mode:disabled"></input>直接写不就行了吗。
      

  5.   

    agree楼上地,用CSS控制!
    .disabled{ ime-mode:disabled; }<input id="myInput" type="text" size=60 class=disabled>
      

  6.   

    <input type="text" name="T1" size="20"><script>
    T1.disabled = true;
    </script>
      

  7.   

    http://goody9807.cnblogs.com/archive/2005/07/05/186620.html我试过可以的
      

  8.   

    我遇到的問題是在控制textbox中最多只能輸入100個字符﹐在輸入了100個字符之后﹐再輸入更多的字符也只取前100個字符。用英文輸入可以達到效果﹐但是用拼音輸入法輸入第101個字符時它會把所有輸入的字符清空﹐我就想控制在輸入100個字符之后不能再用拼音輸入法
      

  9.   

    用正则表达式
    [a-zA-Z0-9]{100}
      

  10.   

    给你个好用的方法,现在限制输入字数的网站一般都这么做:<SCRIPT LANGUAGE="JavaScript">
    <!--
    function textCounter(field, maxlimit) { 
        if (field.value.length > maxlimit) 
            field.value = field.value.substring(0, maxlimit); 
    }
    //-->
    </SCRIPT>
    <textarea name=words cols=73 rows=5 class="" onPropertyChange="textCounter(words,10)"></textarea>
      

  11.   

    我是這樣用的
    后端﹕textbox.attributes.add("onkeydown","javascript:Control(this.form." & textbox.clientID & ",100);")
    客戶端﹕
    function Control(field,count)
    {
        if (field.value.length=100){
        field.style.imeMode="disabled";
        }
    }
    可是這樣用不行﹐為什么﹖我是這樣用的
    后端﹕textbox.attributes.add("onkeydown","javascript:Control(this.form." & textbox.clientID & ",100);")
    客戶端﹕
    function Control(field,count)
    {
        if (field.value.length=100){
        field.style.imeMode="disabled";
        }
    }
    可是這樣用不行﹐為什么﹖