Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6734413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:53:09+00:00 2026-05-26T10:53:09+00:00

The situation I have is a drop down list and an image on a

  • 0

The situation I have is a drop down list and an image on a html page. I’m using javascript script. I’m using a switch statement. I’ve constructed my switch and case statements. So far I got an alert box for each case that displays a unique message in the browser when I make a selection in the drop down list. But I want the image on the page to change with each message. I tried using multiple variables in the switch parameter but that disables the alert boxes. Is there a way for me to use a single switch variable that can call the message boxes and the images? Or is there a way to use multiple variables in the switch parameter? I’ve been researching the internet, even this forum for answers, but haven’t found anything that matches my problem. I found some answers using if statements and AJax but that is outside of the scope of my homework and what we’ve learned so far. So basically my task is to use a switch construct to evaluate the selection and when a match is found, display the appropriate image and the alert box. Any suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:53:09+00:00Added an answer on May 26, 2026 at 10:53 am

    You can change the source of the image for each case. Switch statements only accept one parameter.

    HTML

    <img src="image_path" id="myImage" />
    

    JavaScript

    var img = document.getElementById( "myImage" );
    switch( value ) {
        case 0:
            alert( "message" );
            img.src = "new_path";
            break;
        case 1:
            alert( "message" );
            img.src = "new_path";
            break;
        default: break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the situation I have a webpage which has one drop down called prefer.
See ,I have drop down control and i have keep the LIST as datasource.
I have a situation where I have multiple drop down lists that are hidden
I'm designing a webpage where I have a combobox (drop down list) and it
Situation: I have a simple XML document that contains image information. I need to
how can i create a drop down list with action which allow me link
I have following code @using (Html.BeginForm()) { @Html.DropDownListFor(m => m.IDs, new SelectList(Model. IDs), Model.SelectedID)
I'm trying to build a css drop down menu. I have a div #category_list
I have two drop downs on a page whose backing bean is Request Scoped.
So this is sort of an exceptional case situation - I have a plugin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.