<html>
<body>
<script type="text/javascript">
function changeText2(){
var userInput = document.getElementById('userinp').value;
document.getElementById('hii').innerhtml=userInput;
}
</script>
<p>My name is <b id='hii'>yogesh</b> </p>
<input type='text' id='userinp' value="enter text"/>
<input type='button' onclick='changeText2()' value="changeme!!"/>
</body>
</html>
这不适用于点击事件。我已将链接中的其他代码复制为http://www.tizag.com/javascriptT/javascript-innerHTML.php,如上所述,可以帮助我.......