Javascript Code Change Button Properties onchange Event

<html>
<head> Javascript Events</head>
<style>
.btn{
   width:200px;
   height:200px;
   }

</style>
<body>
<h2> Enter color</h2>
<input type="text" id="input1" /> 
<h2> Enter number</h2>
<input type="number" id="input2" onchange="onchangeevent()"/> <br><br>
<input class="btn" type="button" id="display1" >


<script>
<!--
function onchangeevent()
{
document.getElementById("input2");
                n=document.getElementById("input2").value; 
                c=String(document.getElementById("input1").value); 
                
                document.getElementById("display1").style.background=c;  
                    document.getElementById("display1").value=c; 
                    
                
}
//-->
</script>
</body>
</html>
The Output of the Code :
Javascript Events

Enter color

Enter number



Comments

Popular posts from this blog

Javascript Code using getElementById and If Else Statement

Javascript Code Using If Else to Compute Discount based on Grades