CSS15
CSS15
15
Q1)Write a Java script to modify the status bar using on MouseOver and on MouseOut
with links. When the user moves his mouse over the link, it will display “MSBTE” in the
status bar. When the user moves his mouse away from the link the status bar will display
nothing.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modify Status Bar on MouseOver</title>
</head>
<body>
<script>
function displayStatus(message)
{
window.status = message;
}
function clearStatus()
{
window.status = '';
}
</script>
</body>
</html>
Q2) Write a JavaScript that sets a crawling status bar message to the webpage.
Message is “Welcome to the Mystic World of JavaScript”.The message must start crawling
when the webpage gets loaded
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Crawling Status Bar</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
#crawlingMessage {
position: fixed; /* Fixed position at the top */
top: 0;
left: 100%; /* Start from the right */
white-space: nowrap; /* Prevent wrapping */
font-size: 24px; /* Font size */
background-color: #282c34; /* Background color */
color: white; /* Text color */
padding: 10px; /* Padding around the message */
z-index: 1000; /* Ensure it's on top */
}
</style>
</head>
<body>
<div id="crawlingMessage">Welcome to the Mystic World of JavaScript</div>
<script>
function startCrawling() {
const message = document.getElementById('crawlingMessage');
const windowWidth = window.innerWidth;
let position = windowWidth;
function crawl() {
position -= speed;
message.style.left = position + 'px';
if (position < -message.offsetWidth) {
position = windowWidth }
requestAnimationFrame(crawl); }
crawl();
}
window.onload = startCrawling;
</script>
</body>
</html>
Output:
Q3) What is Status bar and how to display moving message on the status line of a
window using JavaScript ?