Q15
Question 15
Write a java script
a. To change the colour of text using SetTimeOut()
b. To move an image across screen using SetInterval()
Code
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<title>
Change My Colour | Javascript 3 (a. Part)
</title>
</head>
<script language="javascript">
function my_function() {
setTimeout('ppp()',1000);
}
function ppp() {
var colorvalue=prompt("Enter Color","Blue");
document.getElementById("block").setAttribute(
"style","color:" +colorvalue);
}
</script>
</head>
<body>
<center>
<div class="container">
<div class="container-fluid mt-5">
<h1>Change My Colour
| Javascript 3 (a. Part)</h1>
</div>
<div class="container mt-5" id ="block">
<h3>Change My Text Color</h3>
</div>
<div class="container mt-3">
<input type="button"
value="Change Colour"
name="b"
onClick="my_function()">
</div>
</div>
</center>
</body>
</HTML>
Output





Try or Test The Corresponding Code Here
Last updated