下面的代码,哪里错了?为什么用字符串就可以输出正确的值,用object.value输出的就错了呢?
<html>
  <head><title>test</title></head>
  <body>
    <input type="text" value="" id="xxx" />
    <input type="button" value="click" onclick="reg()" />
    <script type="text/javascript">
      function reg() {
        var x = document.getElementById('xxx');
        alert("\t".replace(/\t/g,"\\\\t"));
        alert((x.value).replace(/\t/g,"\\\\t"));
        alert((x.value+"").replace(/\t/g,"\\\\t"));
      }
    </script>
  </body>
</html>