日期:2014-05-16  浏览次数:20441 次

获得文本框的值
PHP code

<!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>
    <title></title>
    <script language="javascript">
        function test(obj)
        {
        var obj_input = document.getElementById("input_text");
            if (obj.checked)
            {
                obj_input.disabled = false;
                obj_input.focus();
            }
            else
            {
                obj_input.disabled = true;
            }
        }
    </script>
</head>
<body>
<input type="checkbox" value="0" id="cb_0" /><label for="cb_0">0</label><br /><input type="checkbox" value="1" id="cb_1" /><label for="cb_1">1</label><br /><input type="checkbox" id="cb_2" value="2" /><label for="cb_2">2</label><br /><input type="checkbox" id="cb_3" onclick="test(this)" value="-1" /><label for="cb_3">其他</label><input type="text" id="input_text" disabled="true" /> 
</body>
</html>



如果将此文本框激活,我如何获得该文本框中的值?

------解决方案--------------------
document.getElementById("input_text").value;
------解决方案--------------------
探讨

引用:

document.getElementById("input_text").value;


这个是javascript的吗?如果是php的话要怎么获取呢?

------解决方案--------------------
<input type="text" id="input_text" name="input_text" disabled="true" /> 

php代码: print_r($_POST); //看到了什么
------解决方案--------------------
同上 document.getElementById( "input_text ").value;