How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Scott Your Own Question
Scott, MIT Graduate
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
Type Your Homework Question Here...
Scott is online now
A new question is answered every 9 seconds

In gallery.js, create a function named switchPix, and assign

Customer Question

In gallery.js, create a function named switchPix, and assign the names file and desc to values passed to the function.
Add a statement to the function that sets the value of the HTML code for the element with the id pix to the text <img src="images/, followed by the value of the file attribute, followed by .jpg" width="480" height="270" alt=", followed by the value of the desc attribute, followed by ">. (Hint: Remember to use the \ character before any quote character that should appear in the HTML code.)
In nearby.html, add code that loads the contents of the gallery.js file. Add an event handler to the a element for the text Asian Art Museum that responds to the mouse pointer moving over the element to call the switchPix function, passing the values ′asian′,′Asian Art Museum′. Add a second event handler that responds to the link being selected to call the same function with the same values. (Note: The second event handler enables users navigating the Web page with a keyboard to trigger the images to change.)
Repeat Step d to add event handlers to the remaining three links to call the switchPix function, passing the following values:
link text values
City Hall 'cityhall',San Francisco City Hall'
Heart of the City Farmer's Market 'market','Civic Center Farmers Market'
Cable Car Turnaround 'cablecar','Cable Car turnaround'
Open nearby.html in your browser, then move your mouse pointer over the list of links and verify that the image on the right side of the page changes depending on which link you’re pointing to. If necessary, research the keyboard shortcut for your browser that allows moving through the links in a Web page, then use the shortcut to navigate through the links and verify that the same image switch takes place based on the link selected.
Submitted: 1 year ago.
Category: Homework
Customer: replied 1 year ago.
Here's what I have come up with for the function: function switchPix(file,desc){
document.getElementById('pix').innerHTML = ''
}and in my html file :
  • Asian Art Museum

  • City Hall

  • Heart of the City Farmer's Market

  • Cable Car turnaround

  • But it doesn't work. What have I done wrong?
    Expert:  Mr. Gregory White replied 1 year ago.

    Hello, my name is Greg.

    I see this might be time sensitive.

    Do you still need this answered?

    Customer: replied 1 year ago.
    but its not time sensitive it is not due until Saturday March 19.
    Expert:  Mr. Gregory White replied 1 year ago.

    After going through my resources, I do not have what is necessary to complete at this time.

    I am opting out and opening up to the other professionals and messaging a couple who might be able to help.

    Someone should be with you shortly.