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

  • Home
  • SEARCH
  • 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 8855503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:09:03+00:00 2026-06-14T14:09:03+00:00

The following code is to make a lever move back and forth and change

  • 0

The following code is to make a lever move back and forth and change the color of a square. However, the following is the bare bones of the elements involved where I am stuck. The error IE gives me is “value of the property ‘appendChild’: object is null or undefined” This is located at the XXXXX’s in the code. Also, I was getting confused when to use ” ” and when to us ‘ ‘ when I wrote this code. It runs fine until the XXXX’s where I get an error.

  function sliderBox(style){ 
     this.style = style;
     var line = null;
     var bar = null;
     var divElem1 = document.createElement('div');
     this.divElem = divElem1.setAttribute('class', 'sliderBox');

    this.constructDOM = function(){ 
     line = new sliderLine();
     bar = new sliderBar(style);
     var ldE = line.divElem;  
     ldE.appendChild(bar.divElem);  XXXXXX PROBLEM HERE
     var tdE = this.divElem;
     tdE.appendChild(line.divElem);
   }    


 }

  function sliderLine(){
    var divElem1 = document.createElement('div');
    this.divElem = divElem1.setAttribute("class", "sliderLine");
  }

  function sliderBar(style){
    this.style = style;
    var divElem1 = document.createElement('div');
    var sBs = "sliderBar" + style;
    this.divElem = divElem1.setAttribute('class', sBs);
  }

Anybody know?

  • 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-14T14:09:04+00:00Added an answer on June 14, 2026 at 2:09 pm

    You are assiging divElem to the return value of setAttribute in the last line of your code. The return value of setAttribute is null or undefined [1]. When you try to appendChild in the line marked with XXXX this gives an error. You should change you sliderBar function to

    function sliderBar(style){
       this.style = style;
       var divElem1 = document.createElement('div');
       var sBs = "sliderBar" + style;
       divElem1.setAttribute('class', sBs);
       this.divElem = divElem1;
    }
    

    [1] http://reference.sitepoint.com/javascript/Element/setAttribute

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

Sidebar

Related Questions

What do I have to change from the following code to make the Storyboard
What do I have to change in the following code to make the A
I have the following code to make a jsonp call. var contacts; $.ajax({ url:
I am using the following code to make a HttpWebRequest and render the XML
I'm trying to use the following code to make an image fadeOut and, only
At a website , I found the following code to make a jQuery plugin:
I have the following code where I make an copy of my database that
I am using the following code to get make an IMAP connection. I am
I'm using the following code to just make a single UILabel on my cell.
The following code is supposed to make the right 60% of the display red.

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.