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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:30:32+00:00 2026-06-14T20:30:32+00:00

I have an array consisting of several objects containing Strings. I am successfully able

  • 0

I have an array consisting of several objects containing Strings. I am successfully able to display the array by using:

<td><p onclick="theMiddle(this)">The Middle</td>

As you see from the td tag this is part of a table. Issue is that the browser opens up a new page to display my text. I have been trying to display the array above my table in a p tag.

//JavaScript
var arrayTheMiddle = new Array (showName.theMiddle, beginingTime.theMiddle, 
network.abc, duration.thirty, rating.general, description.theMiddle, showImage.theMiddle);  

function theMiddle(obj){
   for(i=0; i < arrayTheMiddle.length; i++)
     {
      document.write(arrayTheMiddle[i] + "<br>");
     }
}

//HTML File

<p>Would like the array/function displayed here while the user clicks within the table below (entire table has not been listed)</p>

<td><p onclick="theMiddle(this)">The Middle</td>

Unfortunately I am constantly failing at utilizing get element by id to call my function which consists of an array. I have searched for all sorts of stuff, yet frankly I’m lost. Not even sure if my approach is correct at this point. I’m sure this is one of those simple things that are blowing over my head!

  • 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-14T20:30:33+00:00Added an answer on June 14, 2026 at 8:30 pm

    Strongly suggest using one of the several excellent JavaScript frameworks to do this type of work. I prefer Dojo, many love jQuery.

    There isn’t enough context here to see what is not working, but you almost always are better off avoiding document.write, which simply appends text to the HTML of the document–I don’t think that is what you want in this case.

    You want to create child nodes of some container node. Normally, you would put a container node in your markup with no content for that purpose, lets call it <div id='container'>.

    Then you would do something like this (I am far too lazy to test hand-coded DOM manipulation, but this is the idea):

    var container = document.getElementById('container');
    for (var m : theMiddle) {
       if (theMiddle.hasOwnProperty(m)) {
          var txt = document.createTextNode(m);
          container.appendChild(txt); 
          var br = document.createNode('br'); // I don't approve of br, but that is not relevant here
          container.appendChild(br);
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a NSMutableArray consisting of several elements. From this array I want to
I have a 20 by 10 array consisting of doubles and short strings (fewer
I have some array data returned from an ajax call consisting of an image
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
I have array of strings, String[] data and it's 10 elements has value P
When I have array of objects, when I type the name of variable in
i have a string array consisting of a name and a score. I want
I have an array of points (called points ), consisting of ~30000 x,y, and
Suppose that I have an array consisting of n elements. 1 2 3 4

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.