6th unit CSS
6th unit CSS
The status bar in a web application is used to display information about the state of the web page or
application. It often shows status updates such as loading progress, error messages, or tips, and is
usually located at the bottom of the web browser window.
2. State the method to put a message in the web browser status bar?
You can set a message in the browser's status bar using JavaScript. The window.status property is
used for this purpose. Here's an example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
</script>
</head>
<body>
</body>
</html>
3. Write a JavaScript program that creates a scrolling text on the status line of a window.
You can create scrolling text in the browser's status bar using window.status and a loop. Here's an
example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var i = 0;
function scrollStatusBar() {
i++;
if (i > scrollMessage.length) {
i = 0;
setTimeout(scrollStatusBar, 200);
window.onload = scrollStatusBar;
</script>
</head>
<body>
</body>
</html>
4. Write a program to display a JavaScript status bar message whenever your users hover over your
hyperlinks.
This can be done using the onmouseover event on a hyperlink. Here's an example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function showMessage() {
function resetMessage() {
window.status = "";
}
</script>
</head>
<body>
</body>
</html>
This can be achieved by modifying the status message dynamically in JavaScript. Here’s an example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var i = 0;
function scrollStatusBar() {
i++;
if (i > message.length) {
i = 0;
setTimeout(scrollStatusBar, 200);
window.onload = scrollStatusBar;
</script>
</head>
<body>
<h1>Check out the horizontal scrolling message in the status bar!</h1>
</body>
</html>
A banner ad is a form of online advertising where an image or graphic is placed on a webpage with
the intent to attract attention. When clicked, it typically redirects the user to a different page or
website.
7. Develop a JavaScript program to create rotating banner ads with URL links.
You can create a rotating banner ad using JavaScript by dynamically changing images. Here's a
sample program:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var banners = [
];
var currentBanner = 0;
function rotateBanner() {
document.getElementById("banner").src = banners[currentBanner].image;
document.getElementById("banner-link").href = banners[currentBanner].url;
setInterval(rotateBanner, 3000);
</script>
</head>
<body>
</a>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</a>
</body>
</html>
Here's an example:
<!DOCTYPE html>
<html>
<head>
<title>Banner Ad with URL</title>
</head>
<body>
</a>
</body>
</html>
A pull-down menu is a type of navigation menu where options are revealed when the user clicks or
hovers over a menu item. Here's an example:
<!DOCTYPE html>
<html>
<head>
<title>Pull-Down Menu</title>
<style>
.menu {
list-style-type: none;
.menu > li {
position: relative;
display: inline-block;
padding: 10px;
background-color: #4CAF50;
display: block;
.menu ul {
display: none;
position: absolute;
top: 100%;
left: 0;
list-style-type: none;
background-color: #4CAF50;
.menu ul li {
display: block;
padding: 10px;
</style>
</head>
<body>
<ul class="menu">
<li>Menu 1
<ul>
</ul>
</li>
<li>Menu 2
<ul>
</ul>
</li>
</ul>
</body>
</html>
13. What is a dynamic menu?
A dynamic menu is a menu that can be modified or updated based on user interaction or other
factors, such as user preferences, roles, or real-time data.
A dynamically changing menu can be built by updating the menu items based on user input or
actions. Here's an example:
<!DOCTYPE html>
<html>
<head>
<title>Dynamic Menu</title>
<script type="text/javascript">
function updateMenu() {
menu.appendChild(newItem);
</script>
</head>
<body>
<ul id="menu">
<li>Item 1</li>
<li>Item 2</li>
</ul>
</body>
</html>
15. What is a float menu?
A float menu is a menu that remains fixed in place while the user scrolls the page, usually appearing
on the left or right side of the screen. This type of menu "floats" above other content, ensuring easy
access to navigation links no matter where the user is on the page
<!DOCTYPE html>
<html>
<head>
<title>Float Menu</title>
<style>
.float-menu {
position: fixed;
top: 50%;
left: 0;
background-color: #4CAF50;
padding: 15px;
width: 150px;
.float-menu a {
display: block;
padding: 10px;
color: white;
text-decoration: none;
.float-menu a:hover {
background-color: #333;
</style>
</head>
<body>
<div class="float-menu">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Contact</a>
</div>
<h1>Main Content</h1>
</div>
</body>
</html>
A chain select menu involves multiple select dropdown menus where the options in one menu
depend on the selection in another menu. For example, if you select a country in the first menu, the
second menu will show the states of that country.
Example:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function updateStates() {
var states = {
};
state.innerHTML = "";
option.textContent = states[country][i];
state.appendChild(option);
</script>
</head>
<body>
<label for="country">Country:</label>
<option value="USA">USA</option>
<option value="India">India</option>
<option value="Canada">Canada</option>
</select>
<label for="state">State:</label>
<select id="state">
<option>Select a state</option>
</select>
</body>
</html>
A tab menu is a navigation component where different content sections are displayed when a user
clicks on a tab. Each tab represents a section of content, and the active tab shows the corresponding
content.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Tab Menu</title>
<style>
.tabs {
display: flex;
.tab {
background-color: #ddd;
margin-right: 5px;
cursor: pointer;
.tab:hover {
background-color: #ccc;
.tab-content {
display: none;
padding: 20px;
background-color: #f4f4f4;
.active {
background-color: #4CAF50;
color: white;
.show {
display: block;
</style>
<script type="text/javascript">
function openTab(tabIndex) {
tab.classList.remove("active");
contents[index].classList.remove("show");
});
tabs[tabIndex].classList.add("active");
contents[tabIndex].classList.add("show");
</script>
</head>
<body>
<div class="tabs">
</div>
</body>
</html>
A folding tree menu (or collapsible tree menu) is a hierarchical menu where sub-menu items can be
expanded or collapsed to show or hide nested options. This is often used to display large menus or
categories with many sub-items.
Example (simplified):
<!DOCTYPE html>
<html>
<head>
.tree ul {
list-style-type: none;
padding-left: 20px;
.tree li {
cursor: pointer;
.tree li ul {
display: none;
display: block;
</style>
<script type="text/javascript">
function toggleMenu(event) {
var li = event.target.closest("li");
li.classList.toggle("active");
</script>
</head>
<body>
<ul class="tree">
<li onclick="toggleMenu(event)">Item 1
<ul>
<li>Sub-item 1.1</li>
<li>Sub-item 1.2</li>
</ul>
</li>
<li onclick="toggleMenu(event)">Item 2
<ul>
<li>Sub-item 2.1</li>
<li>Sub-item 2.2</li>
</ul>
</li>
</ul>
</body>
</html>
A scrollable menu is a menu that allows the user to scroll through the options when the list of items
exceeds the visible area. It’s useful for menus with many options, preventing them from taking up
too much screen space.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Scrollable Menu</title>
<style>
.scrollable-menu {
width: 200px;
height: 150px;
overflow-y: scroll;
background-color: #f4f4f4;
.scrollable-menu a {
display: block;
padding: 10px;
color: black;
text-decoration: none;
.scrollable-menu a:hover {
background-color: #ddd;
</style>
</head>
<body>
<div class="scrollable-menu">
</div>
</body>
</html>
20. Create a slideshow with a group of four images, also simulate the next and previous transitions
between slides in your JavaScript.
Here’s how you can create a simple image slideshow with "Next" and "Previous" buttons:
<!DOCTYPE html>
<html>
<head>
<title>Image Slideshow</title>
<style>
.slideshow-container {
position: relative;
width: 100%;
max-width: 600px;
margin: auto;
.slides {
display: none;
width: 100%;
height: auto;
.prev, .next {
position: absolute;
top: 50%;
padding: 10px;
color: white;
cursor: pointer;
font-size: 18px;
.prev {
left: 0;
.next {
right: 0;
</style>
<script type="text/javascript">
var slideIndex = 0;
function showSlides() {
slides[i].style.display = "none";
}
slideIndex++;
setTimeout(showSlides, 3000);
function plusSlides(n) {
slideIndex += n;
slides[i].style.display = "none";
window.onload = showSlides;
</script>
</head>
<body>
<div class="slideshow-container">
<div class="slides">
</div>
<div class="slides">
</div>
<div class="slides">
</div>
<div class="slides">
</div>
</div>
</body>
</html>
21. List ways of protecting your webpage and describe any one of them.
2. Validate User Input: Prevents injection attacks by ensuring that input follows the required
format.
3. Cross-Site Scripting (XSS) Protection: Ensures that user input is sanitized and safe to use on a
webpage.
5. Regular Security Patches: Ensure that your website and server are up to date with the latest
security patches.
6. Limit Permissions: Only allow users access to the necessary parts of your website or server.
8. Firewalls and Security Software: Install and configure firewalls to protect your website from
unauthorized access.
Ensure your server is configured to support HTTPS (SSL/TLS) for encrypted communication.
22. Write a JavaScript that disables the right-click button and displays the message 'Right-click
button is disabled'.
<!DOCTYPE html>
<html>
<head>
<title>Disable Right Click</title>
<script type="text/javascript">
document.addEventListener('contextmenu', function(event) {
event.preventDefault();
});
</script>
</head>
<body>
</body>
</html>
JavaScript Frameworks are libraries that provide pre-written JavaScript code to simplify the
development of web applications. They offer a structure for organizing code, enhancing productivity,
and streamlining complex tasks like DOM manipulation, event handling, and AJAX requests.
1. React.js:
2. Angular.js:
o Uses two-way data binding, making it easier to synchronize the model and view.
3. Vue.js:
4. Node.js:
5. Express.js:
Applications:
• React.js is commonly used for building interactive user interfaces like social media sites,
dashboards, and e-commerce platforms.
• Angular.js is widely used for enterprise applications, data-heavy web apps, and content
management systems.
• Vue.js is suitable for building both small applications and large-scale SPAs, and is often
preferred for its ease of integration with existing projects.
• Node.js is ideal for building fast and scalable server-side applications, such as APIs, chat
applications, and real-time applications like online games.