473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

JavaScript that doesn't work in IE6

3
I have written some code to create a table using javscript it works fine in firefox but does not show the table in IE6

Expand|Select|Wrap|Line Numbers
  1. // JavaScript Document
  2.  
  3.  
  4. var easy = "046280000500600740200000000005032070021000480030170500000000005094001007000096830";
  5. var easySplit = easy.split('');
  6. var eAns = "946287351583619742217543698865432179721965483439178526678324915394851267152796834";
  7. var eAnspl = eAns.split('');
  8. var medium = "000800017430000000002000900200008000097603480000700005006000100000000048580001000";
  9. var medSplit = medium.split('');
  10. var hard = "900001050765000000100300008000006040000218000090400000600004002000000837030100005";
  11. var hardSplit = hard.split('');
  12.  
  13.  
  14.  
  15. var celltab = document.getElementById('sudoform');
  16. var cells = document.getElementsByTagName('input');
  17. var enter = '';
  18. var enter1 = new Array();
  19. //function to create the 3*3 regions
  20. function createTable(){
  21.     if (!getElementById || !document.createTextNode){return;}
  22. var cellno=0;
  23. for(var k=1; k<4 ; k++){
  24.     var d=document.getElementById('sudo');
  25.     var box= document.getElementById('b'+(k));
  26.     var table=document.createElement('table');
  27.     table.setAttribute('id', 'intable'+k);
  28.     for(var i=1; i<4; i++){
  29.  
  30.         var row = document.createElement('tr');
  31.  
  32.             for(var j=1; j<4; j++){
  33.                 cellno++;
  34.                 var cell = document.createElement('td');
  35.                 var input = document.createElement('input');
  36.                 input.setAttribute('type','text');
  37.                 input.setAttribute('maxlength','1');
  38.                 input.setAttribute('size','1');
  39.                 //input.setAttribute('value',cellno);
  40.                 input.setAttribute('readonly','true');
  41.                 row.appendChild(cell);
  42.                 cell.appendChild(input);
  43.             }
  44.         table.appendChild(row);
  45.         table.insertRow();
  46.         }
  47.         box.appendChild(table);
  48.         row.setAttribute('id', 'k'+k);
  49.     }
  50.  
  51.  
  52. }
  53.     //run the 3*3 function three times to create 9 regions in all
  54.     function createTables(){
  55.  
  56.         for(var z=0; z<3; z++){
  57.         createTable();
  58.         }
  59.     }
  60.  
  61. //function to assign each cell an ID
  62.  
  63. function assignID() {
  64.  
  65.     for(var m=1; m<cells.length+1;m++){
  66.  
  67.         cells[m-1].setAttribute('id','c'+m);
  68.         cells[m-1].setAttribute('value', easySplit[m-1]);
  69.         //if(cells[m-1].value=='0'){
  70.         //input.setAttribute('readonly','false');
  71.             //}
  72.             if(cells[m-1].value==0){
  73.             cells[m-1].value='';
  74.             cells[m-1].removeAttribute('readonly');
  75.             }
  76.         }
  77.  
  78. }
  79.  
  80. function checkValues(){
  81.  
  82.     for(var a=0; a<=cells.length-1; a++){
  83.  
  84.         enter += String(cells[a].getAttribute('value'));
  85.  
  86.     }
  87.     if (eAns!=enter){
  88.     alert('sorry it is not right');    
  89.     }else{
  90.         alert('Congratualtions you have completed the easy level');
  91.     }
  92.  
  93. }
Please post code using code tags - moderator

I cant seem to figure out the problem. I am quite new to javascript and i was also wondering is it better to create tables using javascript or is it better to just use XHTML and use java just to access the content.

Thanks
May 6 '07 #1
3 1758
pbmods
5,821 Expert 4TB
CODE tags, people! CODE tags! It says it right there next to the input box when you're submitting your question!

Is IE giving you an error, or is it just not working?
May 6 '07 #2
pronerd
392 Expert 256MB
If your new to using forums this type of post will usually not get much of a response. The subject line and post it self need to be very specific if you want to get a specific response. Just saying it does not work in IE does not give any one much to go on. Also just dumping all your code on the screen and expecting other go debug it line by line is not realistic. You need to at lest track down the to the section of code that is failing and then post that.

Dose it partially work? If so what parts work? Are you getting an error? If so what? What debugging have to tried? Do you know what section of code is failing?
May 6 '07 #3
One significant difference that I have found with dynamically building tables for IE is the requirement for the TBODY tag. Not sure if there is a way around this, but I would start there. Your code looks pretty straight forward otherwise... who knows, it may work. table -> tbody -> tr -> td
May 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: john | last post by:
I have 2 major issues currently with javascript. 1. Doesnt anybody do any server side javascript anymore. I cant find anything on the net about it. My major issue is with database connections...
6
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
6
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: ...
1
by: Muhammad Abdullah | last post by:
Hi am having some problems with the javascript confirm. i have it working fine on one page and it doesnt even pop up at the other. The code on the working page is, private void...
3
by: 9DeT | last post by:
The javascript works perfect on IE, but on firefox it doesnt. I've pasted both frames source, as well as the page source ( the right frame source.txt was zipped to fit the maximum size allowed)...
17
by: Navodit | last post by:
So I have some code like: if (document.Insurance.State.selectedIndex == 1) { ifIll(); } else if (document.Insurance.State.selectedIndex == 2) { elseKan(); }
20
by: Hush | last post by:
Hi, The following code works fine in IE7 but FF returns with an error: Access denied to achieve the property Element.firstChild. In this line: nodes = xmlDoc.documentElement.childNodes; My...
2
by: pankajsingh5k | last post by:
Dear All, Please help me... I had read an article to lazy load a tab in a tabcontainer using an update panel on http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.