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:
<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