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 7919871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:00:49+00:00 2026-06-03T16:00:49+00:00

Help I’m very new with web developing using ASP.NET. Why is the my web

  • 0

Help I’m very new with web developing using ASP.NET. Why is the my web app does not give the desired output like IE does when debugging my code below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
    h1{color:Blue}
    h2{color:Red}

</style>
<script type="text/javascript">
    function ShowColor() {
        alert("You selected " + SelectColor.value);
        BodyContent.style.backgroundColor = SelectColor.value;
    }
</script>
</head>
<body>
<div id="BodyContent">
    <h1>HelloWorld</h1>
    <h2>Welcome</h2>
    <p>
    This is my first Web Page</p>
    <hr />
    Please select color:
    <select id="SelectColor">
        <option value="white">white</option>
        <option value="yellow">yellow</option>
        <option value="silver">silver</option>
    </select>
    <input id="ButtonColor" type="button" value="Select" onclick="ShowColor()" />
</div>

</body>
</html>

Problem is that FF does not executes the javascript “ShowColor” when i clicked the Select button but IE does.

enter image description here

    function ShowColor() {
        alert("You selected " + SelectColor.value);
        BodyContent.style.backgroundColor = SelectColor.value;
    }
  • 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-06-03T16:00:49+00:00Added an answer on June 3, 2026 at 4:00 pm

    Your javascript function should be as follows:

    function ShowColor() {
        alert("You selected " + document.getElementById("SelectColor").value);
        document.body.style.backgroundColor = document.getElementById("SelectColor").value;
    }
    

    You need to select the actual elements by using javascript. For example document.gelElementById("id of element"), and then change the documents color. This should work in any browser.

    The function now shows the appropriate selected value and actually changes the background of the webpage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Help! I'm using the ASP.Net Login control on a Login page, but the Login
Help! I have a clickonce app built and published using .Net 2.0. This app
Help, I'm trying to create a new post in my wordpress blog with custom
Help with regular expressions needed. I'm trying using regular expressions and preg_match_all find blocks
help out a noob with a simple web development question?? I want to create
Help, Im really sick of using this lots of nbsps in my results page.
Help! When I install my app on the phone to test, it is showing
Help, can anyone give me any pointers as too how and install StarTeam 2006
Help! I'm porting a large ruby app to Grails - but the Grails startup
Help! I'm new to C++... how can I fix this header file? #pragma once

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.