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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:16:55+00:00 2026-06-09T04:16:55+00:00

well I am analyzing a javascript code, but I got confuse in some lines,

  • 0

well I am analyzing a javascript code, but I got confuse in some lines, for example I have this code

function getStyle(el,styleProp)
 {
var x = document.getElementById(el);
if (x.currentStyle)
    var y = x.currentStyle[styleProp];
else if (window.getComputedStyle)
    var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);

if (y.substr(0, 1) == "#"){ return y; } else {

var value = y.split(',');

var R = value[0].substr(4);
var G = value[1];
var B = value[2].substr(0, value[2].length-1);

var RGB =  "#" + toHex(R)+ toHex(G)+toHex(B);

return RGB;

 }
}


function toHex(N) {
if (N==null) return "00";
N=parseInt(N); if (N==0 || isNaN(N)) return "00";
N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
return "0123456789ABCDEF".charAt((N-N%16)/16)
  + "0123456789ABCDEF".charAt(N%16);
}




function pw (form)
{

var d1, d2, d3;

if (navigator.appName == "Netscape"){
d1= getStyle('content', 'background-color'); 
} else {
d1= getStyle('content', 'backgroundColor'); 
}
     d2=form.Name.value;
     d3=form.Name2.value;

Firs of all, I dont know what the variables “R”, “G” and “B” are doing?, are they affecting the variable “d1”? I know that variables “d2” and “d3” are the values of what they said, but what is the value of the variable “d1”?

Some help will be appreciated. Tnx.

  • 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-09T04:16:56+00:00Added an answer on June 9, 2026 at 4:16 am

    This code is pretty straight forward. Variables R, G and B each contain a color, R – red, G – green and B – blue. This only happens if the style doesn’t already represent the color through in a hex format. They are there to be able to convert color back to hex and return in. So yes, in a way they do affect the variable d1. If background-color style is going to be set like this: background-color: #FF00FF d1 is going to be #FF00FF. If the background color is going to be set like this: background-color: rgb(00, 255, 00) d1 is going to be #0000FF, since this function expects some none-existing format like this: background-color: 00, 255, 00 (this is not valid CSS).

    In general this seems like a poorly named and written code.

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

Sidebar

Related Questions

Well friends, I have got this query which works but is very long for
Well, I have a application which somehow requires some system resources, but how do
I have the below question as well as this time i have done some
well i have a configuration like this in the components part of my config
Well after much messing about I have finally got a query that gives sales
Well im here because i have a problem. i have code that was created
Well, I have GridView with editable field like 'TemplateField' with DropDownList. My code: <Columns>
Well, my website can not redirect to https://www.facebook.com/QuaFootSpa from http://quafootspa.com/ I have tried redirection
Well, I was trying to fix this program, and I keep getting the errors
Basically, I have a lot of audio files representing the same song. However, some

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.