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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:15:48+00:00 2026-05-25T02:15:48+00:00

With the code below, I am trying to make a div with displays 5

  • 0

With the code below, I am trying to make a div with displays 5 hidden divs when using the Next button. However, this does not work in IE because on the line:

document.getElementById("pic_container" + c).innerHTML += "<tr id='pic_row" + rowNum + "'></tr>";

is trying to change the inner html of a table, which I know IE does not like. If anyone can give me an alternate solution to this problem, feel free to let me know. None of the solutions I found online helped me out, with the styling of td’s and all that mumbo jumbo.

<html>

<head>
<style>

#container
{
height:256px;
width:517px;
overflow:hidden;
border:1px solid black;

}

.pic_container
{
height:256px;
width:418px;
margin-left:50px;
margin-right:50px;
background-color:yellow;
position:relative;
}

.pic_container input
{
margin-left:47px;
}

.image
{
background-color:red;
height:100px;
width:100px;
}

.image2
{
background-color:blue;
height:50px;
width:50px;
}

</style>

<script>
var num = 1;

function loadDivs(){
var rowNum = 0;
var picNum = 1;
for(var c = 1; c<= 5; c++){
    document.getElementById("container").innerHTML += "<div  class='pic_container'><table id='pic_container" + c + "'></table></div>";
    for(var x = 0; x<4; x++){
        document.getElementById("pic_container" + c).innerHTML += "<tr id='pic_row" + rowNum + "'></tr>";
        if(x == 0){
            for(var dimg = 1; dimg <=4; dimg++){
                document.getElementById("pic_row" + rowNum).innerHTML += "<td><div class='image'></div></td>";
                }
            }
        else if(x ==1){
            for(var dimg = 1; dimg <=4; dimg++){
                document.getElementById("pic_row" + rowNum).innerHTML += "<td><input type='radio' name='imageChooser' value='Pic " + picNum + "'/></td>";
                picNum++;
                }
            }
        else if(x == 2){
            for(var dimg = 5; dimg <=8; dimg++){
                document.getElementById("pic_row" + rowNum).innerHTML += "<td><div class='image'></div></td>";
                }
            }
        else{
            for(var dimg = 5; dimg <=8; dimg++){
                document.getElementById("pic_row" + rowNum).innerHTML += "<td><input type='radio' name='imageChooser' value='Pic " + picNum + "'/></td>";
                picNum++;
                }
            }
        rowNum++;
        }
    }
}

function decrement(){  if(num > 1) num--; }
function increment(){ if(num < 5) num++; }

function getNextId(){ window.location =  "#pic_container" + num;}

function display(){ 
var rads = document.getElementsByName("imageChooser");
for(var i = 0; i < rads.length; i++){
    if(rads[i].checked){ document.getElementById("disp_div").innerHTML = rads[i].value;
    }
}
}
</script>
</head>
<body onLoad="loadDivs()">
    <div id="container">
    </div>

    <a href="javascript:increment(); javascript:getNextId();">Next</a>
    <a href="javascript:decrement(); javascript:getNextId();">Back</a>
    <a href="javascript:display();">Select</a>
    <div id="disp_div"></div>
</body>
</html>
  • 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-05-25T02:15:48+00:00Added an answer on May 25, 2026 at 2:15 am

    Is this what you wanted?

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script>
    var num = 1;
    
    function loadDivs() {
        var rowNum = 0;
        var picNum = 1;
        for (var c=1; c<=5; c++) {
            $("#container").html($("#container").html() + "<div class='pic_container'><table id='pic_container" + c + "'></table></div>");
            for(var x=0; x<4; x++) {
                $("#pic_container" + c).html($("#pic_container" + c).html() + "<tr id='pic_row" + rowNum + "'></tr>");
                switch (x) {
                case 0:
                    for(var dimg = 1; dimg <=4; dimg++)
                        $("#pic_row" + rowNum).html($("#pic_row" + rowNum).html() + "<td><div class='image'></div></td>");
                    break;
                case 1:
                    for(var dimg = 1; dimg <=4; dimg++)
                        $("#pic_row" + rowNum).html($("#pic_row" + rowNum).html() + "<td><input type='radio' name='imageChooser' value='Pic " + (picNum++) + "'/></td>");
                    break;
                case 2:
                    for(var dimg = 5; dimg <=8; dimg++)
                        $("#pic_row" + rowNum).html($("#pic_row" + rowNum).html() + "<td><div class='image'></div></td>");
                    break;
                default:
                    for(var dimg = 5; dimg <=8; dimg++)
                       $("#pic_row" + rowNum).html($("#pic_row" + rowNum).html() + "<td><input type='radio' name='imageChooser' value='Pic " + (picNum++) + "'/></td>");
                }
            rowNum++;
            }
        }
    }
    
    function decrement(){ num = Math.max(1, --num); }
    function increment(){ num = Math.min(5, ++num); }
    
    function getNextId(){ window.location =  "#pic_container" + num;}
    
    function display(){ 
        $("input[name='imageChooser']").each(function() {
                if ($(this).prop("checked")) $("#disp_div").html($(this).val());
            });
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't seem to figure this out, see code below. Trying to make a GET
I'm trying to make tabs and am using easytabs. By the below code, the
I'm trying to make a div draggable without using jQuery UI. However, I'm stuck
Afternoon all, Using the code below I'm trying to load what is render by
I am trying to make a radio button control with a transparent background using
I am trying to make an entire div tag clickable. The code I am
In the code below i`m trying to read a list of selected projects and
In the code below I'm trying to load some images and put them in
The code below is what I am trying to use in order to get
I'm trying to use the code below to send messages via System.Net.Mail and am

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.