FireFox and IE respond differently to my site.

Discussion in 'Javascript' started by zalek, Nov 6, 2007.

  1. zalek

    zalek Guest

    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
     
    zalek, Nov 6, 2007
    #1
    1. Advertising

  2. zalek

    RobG Guest

    On Nov 6, 12:22 pm, zalek <> wrote:
    > Here is my site:http://www.geocities.com/zalekbloom/a2.html


    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);
    }


    --
    Rob
     
    RobG, Nov 6, 2007
    #2
    1. Advertising

  3. zalek

    zalek Guest

    On Nov 5, 10:09 pm, RobG <> wrote:
    > On Nov 6, 12:22 pm, zalek <> wrote:
    >
    > > Here is my site:http://www.geocities.com/zalekbloom/a2.html

    >
    > 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);
    > }
    >
    > --
    > Rob


    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
     
    zalek, Nov 6, 2007
    #3
  4. zalek

    Ritwik Kumar Guest

    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
     
    Ritwik Kumar, Nov 8, 2007
    #4
  5. zalek

    RobG Guest

    On Nov 8, 2:09 pm, Ritwik Kumar <> wrote:
    > 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
    >



    --
    Rob
     
    RobG, Nov 8, 2007
    #5
  6. RobG wrote:
    > On Nov 6, 12:22 pm, zalek <> wrote:
    >> 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)

    ^^^^^
    (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
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Nov 9, 2007
    #6
  7. Randy Webb wrote:
    > Thomas 'PointedEars' Lahn said the following on 11/9/2007 2:30 PM:
    >> Test case:
    >>
    >> try

    >
    > 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
    --
    "Use any version of Microsoft Frontpage to create your site. (This won't
    prevent people from viewing your source, but no one will want to steal it.)"
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
     
    Thomas 'PointedEars' Lahn, Nov 9, 2007
    #7
  8. Randy Webb wrote:
    > Thomas 'PointedEars' Lahn said the following on 11/9/2007 2:47 PM:
    >> Randy Webb wrote:
    >>> Thomas 'PointedEars' Lahn said the following on 11/9/2007 2:30 PM:
    >>>> Test case:
    >>>>
    >>>> try
    >>> 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.

    >
    > 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
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
     
    Thomas 'PointedEars' Lahn, Nov 9, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Honn
    Replies:
    3
    Views:
    3,308
    Teemu Keiski
    Apr 4, 2005
  2. Christopher Richards
    Replies:
    12
    Views:
    1,054
    neredbojias
    Nov 22, 2004
  3. InfiniteVoid
    Replies:
    3
    Views:
    498
    BootNic
    Mar 26, 2006
  4. zalek
    Replies:
    1
    Views:
    386
    Randy Webb
    Nov 6, 2007
  5. usgog
    Replies:
    2
    Views:
    181
Loading...

Share This Page