In Association with Amazon.in   Flipkart

Tuesday, November 19, 2013

JavaScript DOM getElementById Example1

JavaScript DOM Example by Id:

<head>
<script>
function get()
{
document.getElementById("un2").value=document.getElementById("un").value;
document.getElementById("un2").style.color="RED";
document.getElementById("un2").style.backgroundColor="yellow";
}
</script>
</head>
<body>
<input type="text" name="unm" id="un" />
<br />
<input type="button" value="Copy & Paste" onClick="get()" />
<br />
<input type="text" name="unm2" id="un2" readonly="readonly" />
</body>

Output:


No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...