473,396 Members | 1,813 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.

appendChild to div tag problem in firefox.

i need to display the data in grids like msflexgrid in vb. so i wrote the following code. the problem is it works fine under ir but not in firefox. help me.


<html>
<head>
<title>Getting Sticky</title>

<script type="text/javascript">

var iC =0 , iR = 0 ;
var tblWidth =0 ,tblheight = 0 ,tblColspan =0,tblRowspan =0;

function addCell(){
tblheight = "20";tblWidth = "50"; tblColspan = "2";tblRowspan = "1";
mainDivElement = document.getElementById("huti");
newNote = document.createElement("div");
newNote.setAttribute("id", "note" + iC);
newNote.style.width = tblColspan * tblWidth ;
newNote.style.height = tblRowspan * tblheight;
newNote.style.border ="1px ridge";
// newNote.style.borderleft = "0";
newNote.style.backgroundColor="#cccccc";
newNote.style.position="absolute";
newNote.style.top = parseInt(tblRowspan * iR * 21) + 'px';
newNote.style.left= parseInt(tblColspan * iC * 50) + 'px';
mainDivElement.appendChild(newNote);

newNote.innerHTML = iC;
newNote.setAttribute('align','center');
iC++;

}
function addRow() {
iR++;iC=0;
}
</script>



</head>
<body style="background-image:url(../ba.gif)">
<form id="noteForm">
<input type="button" value="Add Cell" onClick="addCell()"/>
<input type="button" value="Add Row" onClick="addRow()"/>
</form>
<div id="huti" style="border:1 #000099 solid;overflow:auto;height:250;width:50%;backgroun d:#FFFFFF">Digitech</div>
</body>
</html>
Jan 10 '07 #1
5 6607
b1randon
171 Expert 100+
i need to display the data in grids like msflexgrid in vb. so i wrote the following code. the problem is it works fine under ir but not in firefox. help me.


<html>
<head>
<title>Getting Sticky</title>

<script type="text/javascript">

var iC =0 , iR = 0 ;
var tblWidth =0 ,tblheight = 0 ,tblColspan =0,tblRowspan =0;

function addCell(){
tblheight = "20";tblWidth = "50"; tblColspan = "2";tblRowspan = "1";
mainDivElement = document.getElementById("huti");
newNote = document.createElement("div");
newNote.setAttribute("id", "note" + iC);
newNote.style.width = tblColspan * tblWidth ;
newNote.style.height = tblRowspan * tblheight;
newNote.style.border ="1px ridge";
// newNote.style.borderleft = "0";
newNote.style.backgroundColor="#cccccc";
newNote.style.position="absolute";
newNote.style.top = parseInt(tblRowspan * iR * 21) + 'px';
newNote.style.left= parseInt(tblColspan * iC * 50) + 'px';
mainDivElement.appendChild(newNote);

newNote.innerHTML = iC;
newNote.setAttribute('align','center');
iC++;

}
function addRow() {
iR++;iC=0;
}
</script>



</head>
<body style="background-image:url(../ba.gif)">
<form id="noteForm">
<input type="button" value="Add Cell" onClick="addCell()"/>
<input type="button" value="Add Row" onClick="addRow()"/>
</form>
<div id="huti" style="border:1 #000099 solid;overflow:auto;height:250;width:50%;backgroun d:#FFFFFF">Digitech</div>
</body>
</html>
I'm seeing cells and rows in Firefox, what is broken?
Jan 10 '07 #2
acoder
16,027 Expert Mod 8TB
It works fine in Firefox if I add rows and cells. It starts from the top of the page. What didn't work in Firefox?
Jan 10 '07 #3
it work but i need like grid (MsFlexgrid in vb). it fine in ie, but in firefox it append at the top of the page. i want to append it in div tag
Jan 11 '07 #4
acoder
16,027 Expert Mod 8TB
it work but i need like grid (MsFlexgrid in vb). it fine in ie, but in firefox it append at the top of the page. i want to append it in div tag
You have the following in your code:
Expand|Select|Wrap|Line Numbers
  1. newNote.style.position="absolute";
Change it to
Expand|Select|Wrap|Line Numbers
  1. newNote.style.position="relative";
Jan 11 '07 #5
thank u friends
Jan 12 '07 #6

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

Similar topics

12
by: Keith Page | last post by:
I have a page that changes a list of checkboxes based on what city you select, however when i insert the new nodes the values are not submitted when the boxes are checked and form is sent, its like...
6
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input...
1
by: Ryan Stewart | last post by:
If you don't want to read this post because of its length, I understand. I've spent two and a half days on this problem and have a good deal of information to relate. And this is kind of a long...
2
by: Stewart | last post by:
Originally posted in comp.lang.javascript: Newsgroups: comp.lang.javascript From: "Stewart" Date: 23 Aug 2005 02:50:04 -0700 Local: Tues, Aug 23 2005 10:50 am Subject: FireFox, RemoveChild,...
4
by: matty | last post by:
Hello, here is an example of what is driving me totally crazy. This example will show that the first call to "doit()" will print 30 times the image with only one call to the server. Then I have...
2
by: Christina | last post by:
I have 2 list boxes - one to fill the second one based on the selection, or move all items. You can remove the selection (or all items) from the second one to place it back in the first one. I...
1
by: devman1309 | last post by:
Hi, I am using this code to add hidden fields dynamically before the form submission. function transfer(actionValue,tms) { var formElement = document.forms; document.forms.action =...
1
by: Derek Basch | last post by:
I spent several hours struggling with dynamic form fields added with appendChild or innerHTML not POSTing on submit in Firefox. The only way I found to make it work is to append any created fields...
1
by: cleancode | last post by:
Suppose I have a Parent DIV element and I dynamically add DIV's inside it (Children) using appendChild. It works . But if I were to now set the visibility of the Parent DIV to Invisible, although...
2
by: vsanjit | last post by:
Hi all, I've been trying to create a table dynamically upon the generation of en event using the appendChild method in Javascript. This seems to work fine in Firefox, but not in IE7. There's also...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
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.