473,507 Members | 12,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange behavior in IE6 with the DOM

I have a script that shows an absolute positioned div where a user can
select the time in a calendar.

The script works perfect in Firefox but in IE6 only my test text node
shows up, not any of the tables.

The page http://demo.patch.dk/test.php show a working example click the
button to show the div.
The script http://demo.patch.dk/plugin/Js/time.js

Any idea what could cause this?

/Frederik Sørensen
Jul 23 '05 #1
6 1353
Frederik Sørensen wrote:
I have a script that shows an absolute positioned div where a user can
select the time in a calendar.

The script works perfect in Firefox but in IE6 only my test text node
shows up, not any of the tables.

The page http://demo.patch.dk/test.php show a working example click the
button to show the div.
The script http://demo.patch.dk/plugin/Js/time.js

Any idea what could cause this?

/Frederik Sørensen


I didn't wade through all your code, but it seems you may be adding
your 'tr' elements to the table, not the tbody.

tbody elements are mandatory, but since they are nearly never created
in the HTML, browsers insert them where appropriate. When adding
rows to a table element, Geko browsers assume you meant to add them
to the tbody and so they do that. IE just does nothing.

The solution is to add rows to the tbody, either code a tbody in your
HTML and give it an id so you can find it explicitly, or go down the
DOM from your table element to the tbody and go from there.
--
Rob
Jul 23 '05 #2
RobG wrote:
Frederik Sørensen wrote:
I have a script that shows an absolute positioned div where a user can
select the time in a calendar.

The script works perfect in Firefox but in IE6 only my test text node
shows up, not any of the tables.

The page http://demo.patch.dk/test.php show a working example click
the button to show the div.
The script http://demo.patch.dk/plugin/Js/time.js

Any idea what could cause this?

/Frederik Sørensen

I didn't wade through all your code, but it seems you may be adding
your 'tr' elements to the table, not the tbody.

tbody elements are mandatory, but since they are nearly never created
in the HTML, browsers insert them where appropriate. When adding
rows to a table element, Geko browsers assume you meant to add them
to the tbody and so they do that. IE just does nothing.

The solution is to add rows to the tbody, either code a tbody in your
HTML and give it an id so you can find it explicitly, or go down the
DOM from your table element to the tbody and go from there.


Ah, just found it:

var tableHour = document.createElement('table');
...
var tableHourRow = document.createElement('tr');
...
tableHour.appendChild(tableHourRow);

Create a tbody, append it to the table element then append your rows
to the tbody.

--
Rob
Jul 23 '05 #3
RobG wrote:
Create a tbody, append it to the table element then append your rows
to the tbody.


That fixed it but i ran into another problem.

All my tmp.setAttribute('style', 'background:blue;'); calls is totaly
ignored by IE6
same with all my tmpLink.setAttribute('onmouseover',
'g_Time.highliteText(\'min'+i+'\')');

But the tmp.setAttribute('id', 'hour'+i); works fine.

I could set the style by using tmp.style.backgroundColor = 'blue'; aso.
which seems to work fine i both IE and firefox.

But how can i fix the onmouseover/onmouseout problem?

tmpLink.onmouseout = 'g_Time.highliteText(\'min'+i+'\')'; is not working

/Frederik Sørensen
Jul 23 '05 #4
Frederik Sørensen wrote:

[problems with setAttribute()]
But the tmp.setAttribute('id', 'hour'+i); works fine.
For HTML documents, I always consider the use of the property
equivalents to be preferable. For instance,

tmp.id = 'hour' + i;
I could set the style by using tmp.style.backgroundColor = 'blue'; [...]
Either that or

tmp.style.setProperty('background-color', 'blue', '');

I tend to use the former.
But how can i fix the onmouseover/onmouseout problem?

tmpLink.onmouseout = 'g_Time.highliteText(\'min'+i+'\')'; is not working


The event properties expect function objects, not strings. The solution
in this case should be:

tmpLink.onmouseout
= new Function("g_Time.highliteText('min" + i + "');");

Instead of writing

Time<identifier> = function(/* ... */) {
/* ... */
};
TimeSelecter.prototype.<identifier> = Time<identifier>;

why not just write:

TimeSelecter.prototype.<identifier> = function(/* ... */) {
/* ... */
};

As far as I can see, none of these interim functions are used directly,
so why clutter the global object with identifiers that aren't necessary?

A point of very little concern: selecter isn't a word in the English
language (as far as I know). Selector is. :)

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #5
JRS: In article <LZ******************@text.news.blueyonder.co.uk >,
dated Wed, 27 Apr 2005 12:56:11, seen in news:comp.lang.javascript,
Michael Winter <m.******@blueyonder.co.invalid> posted :

A point of very little concern: selecter isn't a word in the English
language (as far as I know). Selector is. :)


True : but it may be in the Danish language.

But I find that there's advantage in using unconventional spellings in
code; they are less likely to clash with forgotten extant identifiers,
and one can scan pages for them without being troubled by the word being
rightly used in text.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Jul 23 '05 #6
On 28/04/2005 17:01, Dr John Stockton wrote:
JRS: In article <LZ******************@text.news.blueyonder.co.uk >,
dated Wed, 27 Apr 2005 12:56:11, seen in news:comp.lang.javascript,
Michael Winter <m.******@blueyonder.co.invalid> posted :
A point of very little concern: selecter isn't a word in the English
language (as far as I know). [...]
True : but it may be in the Danish language.


For the record, I had considered that, but I don't think it's likely.
But I find that there's advantage in using unconventional spellings in
code; they are less likely to clash with forgotten extant identifiers [...]


Though one should weigh that against resulting spelling mistakes.
Conventional has it's own benefits, too.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7

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

Similar topics

1
1489
by: Alexander Inochkin | last post by:
Hi! I found same strange behavior of ASP.NET. It is possible this is the bug. Follow the steps:
0
3556
by: ivb | last post by:
Hi all, I am using DB2 8.1.11.1 on NT with ASP.NET 1.1 When application make connection to database (via ADO.NET), it set "Connection timeout" parameter to 30 seconds. After, when my webpage...
6
2250
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
1
2968
by: Nicholas Palmer | last post by:
Hi all, Got a question about the AspCompat=true page property. First a little background. We have an ASP.NET app that uses two COM components. The first is the Microsoft OWC 11 components and...
19
1728
by: david | last post by:
I took old code and decided to modify it a bit, and I just noticed that it does not compile at all and before server one of severs (main) crashed in the system it was working fine (I am really sure...
0
7110
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
7314
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
7372
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
7482
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...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.