Question
Ridgewood Herald Tribune Maria Ramirez manages advertising accounts for the Ridgewood Herald Tribune in Ridgewood, New Jersey. To offset the cost of the papers Web
Ridgewood Herald Tribune Maria Ramirez manages advertising accounts for the Ridgewood Herald Tribune in Ridgewood, New Jersey. To offset the cost of the papers Web site, Maria is selling ad space on the companys home page. She is looking at cre-ating banner ads to be displayed on the papers masthead, with each ad linked to the advertisers Web site. Because ad space on the papers home page is the most valuable, Maria has decided to sell space to five companies, with the selection of the banner ad determined randomly each time a user opens the page. ; Maria has asked for your help in writing the JavaScript code to display banner ads ran-domly. She has provided a collection of functions that will be useful to you. The randInt() function returns random integers from 1 to n. To call the randInt() func-tion, use the following expression:randInt(n) The adDescription() function returns the description of the nth ad from a list of ad descriptions. To call the function, use the following expression:adDescription(n) The adLink() function returns the URL of the nth ad of the collection. To call the func-tion, use the following expression:adLink(n)
Complete the following: 1. Use your text editor to open the fronttxt.htm file from the tutorial.10\case2 folder included with your Data Files. Enter your name and the date in the comment sec-tion of the file. Save the file as front.htm in the same folder. 2. After the link element in the head section, insert a script element accessing the functions in the random.js file. 3. Insert another script element accessing the functions in the ads.js file. 4. Scroll down the file to the div element with the id ads. Replace the content of the div element with a script element containing the following statements:a. Declare a variable named rNumber equal to the value returned from the randInt() function using 5 as the parameter value. Append the following comment to the statement:generatearandomintegerfrom1to5b. Declare a variable named rAd equal to the text string returned from the adDescription() function using Number as the parameter value. Append the following comment to the statement:descriptionoftherandomadc. Declare a variable named rLink equal to the URL returned from the adLink() function using Number as the parameter value. Append the following comment:URLoftherandomad
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started