Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在数字和字母之间添加间距_Javascript_Html_Css - Fatal编程技术网

Javascript 在数字和字母之间添加间距

Javascript 在数字和字母之间添加间距,javascript,html,css,Javascript,Html,Css,如果我写“12345测试”输出为“1 2 3 4 5 t e s t”,如何添加间距 这是我的密码 <input type="text" placeholder="Write something" id="testInput" value="" onFocus="getElementById('test').innerHTML=getElementById('testInput').value;datum();" onKeyUp="g

如果我写“12345测试”输出为“1 2 3 4 5 t e s t”,如何添加间距

这是我的密码

<input type="text" placeholder="Write something" 
                  id="testInput" value=""
   onFocus="getElementById('test').innerHTML=getElementById('testInput').value;datum();"   
   onKeyUp="getElementById('test').innerHTML=getElementById('testInput').value;">

<div style="z-index: 2; position: absolute; left: 10px; top: 100px; height: 29px; width: 400px; color: black; font-weight: bold; font-size: 26;">
   <span id="test"></span>
</div>


非常感谢

您可以在CSS中使用
字母间距
属性:

...
letter-spacing: 5px;  /* will separate each character by 5 pixels */
...

…innerHTML=getElementById(…).value.split(“”).join(“”)