2013-03-16 57 views
0

單擊更改文本時,我需要在屏幕的另一部分顯示我的文本框的值。我怎樣才能做到這一點?如何讓文本框的值在屏幕上的所需位置上顯示

<div id="placetextfield"> 
    <script> 
    var textfield = "Enter text on shirt:"; 
    textfield = textfield.bold() 
    textfield = textfield.fontsize(5) 
    document.write("<p>" + textfield.fontcolor("#FF6600") + "</p>"); 
    </script> 

    <script type="text/javascript"> 
    function changeText2(){ 
     var userInput = document.getElementById('userInput').value; 
     document.getElementById('textfield').innerHTML = userInput; 
    } 
    </script> 

    <b id='textfield'></b> 
    <input type='text' id='userInput'/> 
    <input type='button' onclick='changeText2()'value='Change Text'/> 
</div> 
+1

是不是現在的工作 – PSR 2013-03-16 00:55:52

+0

我檢查現在運轉 – PSR 2013-03-16 00:57:06

+0

什麼是這裏的問題 – PSR 2013-03-16 00:58:09

回答

0
<script type="text/javascript"> 
function changeText2(){ 
    var userInput = document.getElementById('userInput').value; 
    document.getElementById('yourId').innerHTML = userInput; 
} 
</script> 
<b id='textfield'></b> 
<input type='text' id='userInput'/> 
<input type='button' onclick='changeText2()'value='Change Text'/> 
+0

我試過這個,這是我的編號 #altext { position:absolute; right:0px; top:50px; } 替代('yourId')與('altext') 它不會再顯示文本字段值 – user2125086 2013-03-16 01:15:43

相關問題