473,395 Members | 1,440 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,395 software developers and data experts.

NS/Mozilla/Firefox mergeAttributes problem

I've been working on a project converting some IE code to be
cross-browser complient. I've run into a little problem figuring out
how to migrate the IE specific mergeAttributes function to something
similar that is complient in NS/Mozilla/Firefox browsers.

Currently I have this basic code
row = this.insertRow(position) //I'm inserting a row into "this" table
row.mergeAttributes(this.templateRow); //here I'm basically "copying"
this template row to the newly created row
// clone all the cells from the template to the new row.
var cells = this.templateRow.childNodes;
for (var i = 0; i < cells.length; i++)
{
var cell = cells[i].cloneNode(true);
row.appendChild(cell);
}

Basically, I need to come up with a way to copy the attributes from the
the template row to the new row along with all the cells.

I've tried using the cloneNode method on the template row and assigning
the returned element to the row object that was created. This does not
work. Inside these row objects properties have been added, and if I'm
reading this code correctly, it appears that some TR level functions
have been added as well.

Thanks in advance. This has been wreaking some havoc on me for a while
and I don't currently see a solution to it. Thanks!

Mike G.

May 10 '06 #1
1 3182
mi******@gmail.com wrote:
I've been working on a project converting some IE code to be
cross-browser complient. I've run into a little problem figuring out
how to migrate the IE specific mergeAttributes function to something
similar that is complient in NS/Mozilla/Firefox browsers.

Currently I have this basic code
row = this.insertRow(position) //I'm inserting a row into "this" table
For this to work, `this' would be required to be a reference to a
HTMLTableRowElement object. But that would require that code to be in
either a method of HTMLTableRowElement.prototype (which is not possible
in the IE DOM yet, and discovered recently to be not fully implemented
in the Gecko DOM yet), or a method of the HTMLTableRowElement object
itself (which is recommended against, as that object is a host object).

And do you declare `row' before you define it? If no, there is another
issue as well, as that "variable" is rather a property of the Global
Object, or a property of another globally available host object that
imposes restrictions on property write access (IE DOM); if there is an
element with ID or name `row', there will be no "variable" but a runtime
error.

So much for "cross-browser compliance".
row.mergeAttributes(this.templateRow); //here I'm basically "copying"
Since you say below that the result of the copy process is the source of
your problems, it would have been wise if you posted its source code.
this template row to the newly created row
Source code should be posted so that it still makes sense when becoming
subject to automatic word-wrapping at about column 76.
// clone all the cells from the template to the new row.
var cells = this.templateRow.childNodes;
for (var i = 0; i < cells.length; i++)
{
var cell = cells[i].cloneNode(true);
row.appendChild(cell);
}

Basically, I need to come up with a way to copy the attributes from the
the template row to the new row along with all the cells.
That is what Node::cloneNode() is for.
I've tried using the cloneNode method on the template row and assigning
the returned element to the row object that was created. This does not
work. Inside these row objects properties have been added, and if I'm
reading this code correctly, it appears that some TR level functions
have been added as well.


You are not making any sense. "TR level functions"? It strikes me that
your "problem" is that _you_ have augmented HTMLTableRowElement.prototype
or the corresponding HTMLTableRowElement object and now are wondering that
the copy either inherits the prototype object's or has the original object's
properties. Well, this behavior would be by design. Simply do not
augment the prototype object or the element object in the first place
then, but pass references to the corresponding element object instead.
PointedEars
--
Let us not judge others because of their religion, color or nationality.
We are all just human beings living together on this planet. (poehoe.de)
May 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: M.D. | last post by:
Hi, I am having a problem with my program which only happens when using Mozilla or Firefox. The pages I wrote, are part of a private web directory, a service offered by the ISP, which upon...
2
by: anna | last post by:
Firefox Mozilla Browser Fonts / Format / rich text / webmail question I have Comcast. They do not support Firefox so they won't help me. When I use Mozilla firefox browser to access my web...
10
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer...
5
by: Jarson | last post by:
My JavaScript is trying to POST data to a CGI script (Perl) using XMLHttpRequest. My CGI server gets different data from IE than Mozilla Firefox. // For Mozilla, req = new XMLHttpRequest(); //...
6
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... ...
0
by: autogoor | last post by:
I want to put a java Applet in a jsp page. Here is what I used: <jsp:plugin type="applet" code="mypackage.myApplet" width="450" height="350" > <jsp:params>...</jsp:params>
10
by: News | last post by:
I have a page up trying to learn how to ID a browser and other info. http://wyght.com/warren/testPos.html here is the code <script type = "text/javascript"> var space = ", "; var name...
9
by: Alex D. | last post by:
Hi, I have a frame in one of my pages that I use to show diferent pages each time. I am experiencing an weird behaviour in Mozilla and Firefox, when the frame's source is specified in the server...
8
by: Clément | last post by:
Hi! I am currently developping a user interface with Ajax/C#/.net. And I am facing a problem with Mozilla, and Firefox. I use the function innerHTML to load a Web UserControl into a div, this...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...

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.