FireFox and IE respond differently to my site.

Z

zalek

Here is my site:
http://www.geocities.com/zalekbloom/a2.html

When I open this site with FireFox - Select fields "Date from (yyyyy/
mm/dd)" and "Date to (yyyyy/mm/dd)" are not initialized, but they are
initialized when I open this site with IE.

The code that is not working in FireFox but working in IE is:

var option0 = new Option(curr_year,curr_year) ;
document.form1.f_from_yyyy.add(option0) ;

Any idea why?

Thanks,

Zalek
 
R

RobG


The rubbished added by your host inserts scripts that cause errors in
Firefox, and they make your page invalid HTML.

When I open this site with FireFox - Select fields "Date from (yyyyy/
mm/dd)" and "Date to (yyyyy/mm/dd)" are not initialized, but they are
initialized when I open this site with IE.

The code that is not working in FireFox but working in IE is:

var option0 = new Option(curr_year,curr_year) ;
document.form1.f_from_yyyy.add(option0) ;

You are mixing DOM 0 (new Option) and DOM 1 (add method) and Firefox
doesn't like it. Instead, use just DOM 0 (wrapped for posting):

var sel = document.form1.f_from_yyyy;
if (sel) {
sel.options[sel.options.length] =
new Option(curr_year, curr_year);
}
 
Z

zalek


The rubbished added by your host inserts scripts that cause errors in
Firefox, and they make your page invalid HTML.
When I open this site with FireFox - Select fields "Date from (yyyyy/
mm/dd)" and "Date to (yyyyy/mm/dd)" are not initialized, but they are
initialized when I open this site with IE.
The code that is not working in FireFox but working in IE is:
var option0 = new Option(curr_year,curr_year) ;
document.form1.f_from_yyyy.add(option0) ;

You are mixing DOM 0 (new Option) and DOM 1 (add method) and Firefox
doesn't like it. Instead, use just DOM 0 (wrapped for posting):

var sel = document.form1.f_from_yyyy;
if (sel) {
sel.options[sel.options.length] =
new Option(curr_year, curr_year);
}

Thanks Rob,

It worked!

Now another question - I want to display a date on a page.
I used command:

document.write(....)

but after I put this code in function that starts "onLoad" - this code
is not working.
So how to display a date, or other string built by a function?

Thanks,

Zalek
 
R

Ritwik Kumar

Hi,
can u pl help me sort out this problem.....
a site http://www.kuliza.com/ open quite well if i use Internet
explorer but
display if i use firefox is not as desired.... wat could be the reason

ritwik kumar
 
R

RobG

Hi,
can u pl help me sort out this problem.....
a sitehttp://www.kuliza.com/open quite well if i use Internet
explorer but
display if i use firefox is not as desired.... wat could be the reason

While the group will tolerate poor English where it is obvious the
poster is trying their best, it is generally not responsive to
deliberate use of incorrect punctuation and grammar. This is not chat
or SMS, you should ensure your posts are suitable for publishing in a
public forum.

Firefox does not see the stylesheet, it arrives as gobldy-goop, I
suspect you are serving it with the wrong encoding or content type.
In any case, it has nothing to do with javascript. Ask in a news
group dedicated to CSS or HTML:

<URL: http://groups.google.com.au/group/comp.infosystems.www.authoring.stylesheets?hl=en&lnk=li<URL: http://groups.google.com.au/group/comp.infosystems.www.authoring.html?hl=en&lnk=li
 
T

Thomas 'PointedEars' Lahn

RobG said:
You are mixing DOM 0 (new Option) and DOM 1 (add method)
^^^^^
(W3C) DOM Level 2 HTML, to be precise. That standard rendered (W3C) DOM
Level 1 HTML obsolete as it is based on (W3C) DOM Level 2 Core which
includes changes that are incompatible with DOM Level 1.

http://www.w3.org/TR/DOM-Level-2-HTML/ (see "Status of this document")
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-94282980
and Firefox doesn't like it. [...]

At least Firefox 2.0.0.9 (on Windows XP SP2) would have liked it if the
signature of the method had been obeyed. The problem is an incompatibility
between the MSHTML DOM which makes the second argument of add() optional,
and the Gecko DOM which implements the W3C DOM where it is not optional and
omitting it therefore throws an exception.

http://msdn2.microsoft.com/en-us/library/ms535921.aspx

Test case:

try
{
var sel = document.createElement("select");
if (sel)
{
// add more feature tests here
sel.style.position = "absolute";
sel.style.left = "0";
sel.style.top = "0";

var o = new Option("a", "b");

// try this without specifying the second argument
sel.add(o, null);

document.body.appendChild(sel);
}
}
catch (e)
{
window.alert(e);
}


PointedEars
 
T

Thomas 'PointedEars' Lahn

Randy said:
Thomas 'PointedEars' Lahn said the following on 11/9/2007 2:30 PM:

try/catch is error prone on the web. Avoid it as if it were eval. At
least for a while.

Good grief, it is merely a *test case* to prove my point. It is not
supposed to be executed in any other than the mentioned environment.

Someone else has stated recently that it would be appropriate for new code
to rely on support of ECMAScript Edition 3 features. This is one of them,
so that statement was probably too bold to start with.

That said, try..catch was introduced with JavaScript 1.5 (Gecko 0.6),
JScript 5.0 (IE 5.0), and is standardized by ECMAScript Edition 3, which
date back to 2000-11, 1999-03, and 1999-12 CE, respectively. And it is
hardly as error-prone as unnecessary use if eval() is (in any way you
want to look at it), so you are comparing apples and oranges.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Randy said:
Thomas 'PointedEars' Lahn said the following on 11/9/2007 2:47 PM:

What's wrong Thomas? Don't like your own medicine?

Your inability to differentiate is truly amazing. Show me one occasion
where I have criticized an *equal* *test case* *this way* (you can't) or
just shut up.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top