Thursday, 21 January 2016

Output using getElementById

<html>
<head>
</head>
<body>
<p id='feedback'> This is a paragraph for Javascript</p>
<script type='text/javascript'>
document.getElementById('feedback').innerHTML='Hello World!';
</script>
</body>

</html>
.
.

<input id='userInput' size=60> <button onClick='userSubmit()'>Submit</button><BR>
<P><div id='result'></div>
<script type='text/javascript'>
function userSubmit()
{var UI=document.getElementById('userInput').value;
document.getElementById('result').innerHTML='You typed: '+UI;}

</script>

0 comments:

Post a Comment