JavaScript_Answers
JavaScript_Answers
- The status bar in a web application displays information about the current state of the page, such
as loading status, URL of hovered links, and other interactive elements, providing a better user
experience.
2. State the method to put a message in the web browser status bar.
- You can use JavaScript to put a message in the status bar by using `window.status = 'Your
message here';`.
3. Write a JavaScript program that creates scrolling text on the status line of a window.
```javascript
let position = 0;
function scrollText() {
setTimeout(scrollText, 150);
scrollText();
```
4. Write a program to display a JavaScript status bar message whenever users hover over your
hyperlinks.
```html
- This can be done similarly to question 3, by updating the `window.status` with a looping
message.
placed at the top or side of a webpage, and is designed to attract traffic to the advertiser's site.
7. Develop a JavaScript program to create rotating banner ads with URL links.
```javascript
let ads = [
];
let currentAd = 0;
function rotateBanner() {
document.getElementById('banner').src = ads[currentAd].image;
document.getElementById('bannerLink').href = ads[currentAd].url;
setTimeout(rotateBanner, 3000);
rotateBanner();
```
- The banner can be created using HTML and JavaScript, similar to question 7 but with only one
ad image and link.
```html
</a>
```
```javascript
let index = 0;
function showSlide() {
document.getElementById('slideshow').src = images[index];
setTimeout(showSlide, 2000);
showSlide();
```
```html
<select>
<option value="home">Home</option>
<option value="about">About</option>
<option value="contact">Contact</option>
</select>
```