HTML/JavaScript Web Application Answers

Questions: 680

Answers by our Experts: 648

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Difference b/w inline and block element


I need some help creating a modularized JavaScript roll-over function for gallery images that functions correctly and permits additions of images without the need to hard-code the values. I believe the preload is working as it should, but I haven't quite connected all of the dots for the rollover as described below.

Hint: Preloading your images will only work on a hosting server and not your local drive as there’s no load time for your images locally. Once you have preloaded those images, you may want to clear your cache to test your loading of the images again.

Tip: In a smaller JavaScript program such as this one, each function is created for a specific purpose. However, in more complex sites, it is better to build functions that we can apply to multiple situations. For example, rather than specifying an element name or id, we can use a variable that is passed into the function.

Directions

Use the gallery.html and index.html files that you downloaded in the Zip file in Assessment 1. Create functionality using JavaScript on the following pages:

index.html

Preload the gallery images.

Create rollover functionality for each of the thumbnails in your image gallery. Use appropriate images found in the images folder.

Write developer comments to describe the variables being declared and explain the functions and logical blocks of JavaScript code pertaining to the gallery.

Make sure to do the following:

Create an onpageload function to preload all of your images.

Create a modularized rollover function for gallery images.

Here is the HTML code I have so far:

<!DOCTYPE html>

<html lang="en-US">

<head>

<title>Invitation Page</title>

<link rel="stylesheet" type="text/css" href="css/main.css" />

<script src="js/galleryImages.js">

//added preload for the js file preload function

preload('images/firefighter.jpg', 'images/work.jpg', 'images/silhouette.jpg', 'images/event.jpg');

</script>

</head>

<body>

<header>

<div class="top">

<a class="logo" href="index.html">CapellaVolunteers<span class="dotcom">.org</span></a>

</div>

<nav>

<ul class="topnav">

<li><a href="index.html">Home</a>

</li>

<li><a href="invitation.html">Invitation</a>

</li>

<li><a href="gallery.html" class="active">Gallery</a>

</li>

<li><a href="registration.html">Registration</a>

</li>

</ul>

</nav>

</header>

<section id="gallery">

<div class="gallery">

<a target="_blank" href="images/firefighter.jpg">

<img class="image" src="images/firefighter.jpg" alt="firefighter" width="300" height="200"> <!-- added new class image to identify the roll over event with url of the selected image -->

</a>

<div class="desc">Add a description of the image here</div>

</div>

<div class="gallery">

<a target="_blank" href="images/work.jpg">

<img class="image" src="images/work.jpg" alt="work" width="300" height="200"> <!-- added new class image to identify the roll over event with url of the selected image -->

</a>

<div class="desc">Add a description of the image here</div>

</div>

<div class="gallery">

<a target="_blank" href="images/silhouette.jpg">

<img class="image" src="images/silhouette.jpg" alt="silhouette" width="300" height="200"> <!-- added new class image to identify the roll over event with url of the selected image -->

</a>

<div class="desc">Add a description of the image here</div>

</div>

<div class="gallery">

<a target="_blank" href="images/event.jpg">

<img class="image" src="images/event.jpg" alt="event" width="300" height="200"> <!-- added new class image to identify the roll over event with url of the selected image -->

</a>

<div class="desc">Add a description of the image here</div>

</div>

<div id="fullImage"></div> <!-- added new DIV to display full image dynamically from JS-->

</section>

<footer>This events site is for IT-FP3215 tasks.

</footer>

</body>

</html>

Here is the JS I have:

//Preload function has to be included

var images = [];

//function to preload banner images

function preloadBannerImages() {

// get the src of all banner images in document and then preload them

for (var i = 0; i < images.length; i++) {

var img = new Image();

img.src = images[i].src;

}

console.log('Preloading completed!');

}

/*Example of code from professor for this functionality

function setupRollover('img1') {

theImage.outImage = new Image();

theImage.outImage.src = theImage.src;

theImage.oumouseout = function () {

this.src = this.outImage.src;

};

}*/


//Rollover functionality using modularized code

var imageGallery = function () {

var sliderInd = 0; //defining global index to count slide images.

},

addListeners = function () {

var items = document.getElementsByClassName("image"); //getting img elements by CSS class name to register event

for (let index = 0; index < items.length; index++) {

const element = items[index];

element.addEventListener("mouseover", this.loadFullImage, false);

}

},

loadFullImage = function (event) // mouse over event handler function to load full image

{

console.log(event.target.src);

document.getElementById("fullImage").innerHTML = '<img src="' + event.target.src + '"/>'; //adding full image to DIV

},

retObject = {

//public function in return object will be exposed to other members.

init: function () {

addListeners(); // calling method to register mouse over events


}

};



A company wants to transmit data over the telephone, but it is concerned that its phones may be tapped. All of its data is transmitted as four-digit integers. It has asked you to write a program that will encrypt its data so that the data may be transmitted more securely. Your program should read a four-digit integer entered by the user in a prompt dialog and encrypt it as follow: Replace each digit by (the sum of that digit plus 7) modulus 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then display the encrypted integer. Write a program to decrypt the encrypted data.
Write a program to decrypt the encrypted Word. The user enters the encrypted word. For example, if you input JCQQA the program should print out HAPPY.
Ask the user to enter their favourite actor and the role that the actor played. Save the actors in one array and the roles in another array. Ask for four favourite actors. Then ask the user for one of their favourite actors. Find the role that the actor played and display it to the screen.

I need this code in javascript.
create 3 pages webpages with bootstrap
Modify the quiz application in the previous module, this time create a 10-point quiz using a multidimensional array with the use of HTML elements ( forms and tables )
Create a simple web application that converts decimal into binary, octal, hexadecimal, using functions and arrays . Do not use built in function for the conversation


Write a Program:


Write a html and css code to design a "Tour-n-Travels" webpage containing one tourist place with appropriate description. The page should contain a suitable background image, heading should be with a background color, italicised, underlined and centrally aligned, the description should be in a different font color, size and style. The description should be supported with an appropriate image. Also add an Enquiry form for fixing an enquiry call consisting of fields such as name, contact number, date and time and budget ranging from 20000 to 50000 and a summit button 


void setup() { float a,b; int result; serial.begin(9600); a = 15.2; b = 27.1; result = compute(a, b); serial.print(result); } void loop() {} int compute(float number1, float number2){ int comp; comp = number2 * number1; return(comp); }


A. What will be the output on the Serial Monitor?
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS