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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:48:56+00:00 2026-06-01T08:48:56+00:00

<input id=’ad’ onkeyup=’sc(id)’/> <script lang=javascript> function sc(i) { i.style.backgroundColor=#006400; } </script> This is the

  • 0
<input id='ad' onkeyup='sc(id)'/>
<script lang="javascript">
function sc(i)
{
    i.style.backgroundColor="#006400";
}
</script>

This is the code I am using to change the background colour of the input box through id, but it is not working. Please suggest some way to change the background colour of the input box.

  • 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-01T08:48:57+00:00Added an answer on June 1, 2026 at 8:48 am

    If i is an element id, use getElementById()

    <input id='ad' onkeyup='sc(id)'/>
    <script lang="javascript">
    function sc(i)
    {
        // Retrieve the element by its id 'i'
        document.getElementById(i).style.backgroundColor="#006400";
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My input is javascript code that I can pre-process.. at some specific point in
Input rz value In the head I have: Event.observe(window, 'load', function() { $$(input).each(function(field){ Event.observe(field,
input name=currency1 class=currency input name=currency2 class=currency input name=weight1 class=weight input name=weight2 class=weight function init(){
input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;} input,textarea,select{*font-size:100%;} This is from the YUI reset css. What does the * before
input is a string (var str) something like this: <<hello there//abcd//1234>> I want to
Input string was not in a correct format. At this line: int total =
After input some variable, PHP code: $CartItem = array( 'itemID' => $itemID, 'ProductName' =>
Input file containing integers will be like this: 5 2 3 5 2 4
Input files looks like this: Header : Data Header2 : data for header2 Header3
input: position fst 1 0.6 2 0.8 3 0.9 4 0.3 5 1 This

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.