firefox compatible javascript

Discussion in 'Javascript' started by bert76, Oct 3, 2005.

  1. bert76

    bert76 Guest

    can anyone suggest a couple of websites providing *compatible*
    javascript?
    of course there is
    http://javascript.internet.com/
    http://javascriptkit.com/
    and the likes, but time and again you have to try out, test it only to
    find it only works in IE.
    at school, we want to test a number of javascripts, preferably
    compatible with *all* browsers (mainly, but not just firefox).
    tnx for suggestions
    bert76, Oct 3, 2005
    #1
    1. Advertising

  2. bert76

    Randy Webb Guest

    bert76 said the following on 10/3/2005 8:15 AM:

    > can anyone suggest a couple of websites providing *compatible*
    > javascript?
    > of course there is
    > http://javascript.internet.com/
    > http://javascriptkit.com/


    Neither of which is a good js site.

    > and the likes, but time and again you have to try out, test it only to
    > find it only works in IE.


    That's typically what you get from copy-n-paste sites.

    > at school, we want to test a number of javascripts, preferably
    > compatible with *all* browsers (mainly, but not just firefox).
    > tnx for suggestions


    Learn the language, write your own cross-browser scripts.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Oct 3, 2005
    #2
    1. Advertising

  3. bert76

    nikki Guest

    Grab a few that are easy to modify for FF use and modify them.
    As long as they don't do anything too horrible that uses MSIE only
    things that have no FF counterpart (which you usually don't see for
    the web, anyway; you see that sort of thing for intranet apps), it's
    not usually too hard.

    Or go to dynamicdrive.com and make sure you look specifically for
    cross-browser scripts.
    nikki, Oct 3, 2005
    #3
  4. bert76

    Randy Webb Guest

    nikki said the following on 10/3/2005 3:31 PM:


    Please quote what you are replying to, it makes following the
    conversation easier.

    > Grab a few that are easy to modify for FF use and modify them.


    In order to know what is "easy to modify for FF" it requires a level of
    understanding that you wouldn't need to find copy/paste scripts, you
    would already know how to write your own.

    > As long as they don't do anything too horrible that uses MSIE only
    > things that have no FF counterpart (which you usually don't see for
    > the web, anyway; you see that sort of thing for intranet apps), it's
    > not usually too hard.


    And what about scripts that use non-IE code?

    > Or go to dynamicdrive.com and make sure you look specifically for
    > cross-browser scripts.


    Dynamic Drive is just as bad, if not worse, than either of the ones
    mentioned.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Oct 3, 2005
    #4
  5. bert76

    Guest

    bert76 wrote:
    > time and again you have to try out, test it only to
    > find it only works in IE.


    A big part of the problem, I think, is that so much of what you find on
    the web are hacks, instead of good well-written code. Most of it was
    probably written years ago too. Take for example this:

    <html>
    <head>
    <script>function a (){ alert(t.i.value) }</script>
    </head>
    <body>
    <form name="t"><input name="i" onchange="a()"></form>
    </body>

    that works, but it's not valid html. If you change <html> to this:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    then suddenly that code wont work. It wont work because it was invalid
    all along - I'm supposed to use document.getElementById("i"), but if I
    was just throwing together a hack for a tips website, maybe I wouldn't
    care.

    So you see, the problem isn't really compatibility. It's often
    validity.
    , Oct 3, 2005
    #5
  6. bert76

    nikki Guest

    Randy Webb wrote:
    > nikki said the following on 10/3/2005 3:31 PM:
    >
    >
    > Please quote what you are replying to, it makes following the
    > conversation easier.
    >


    Yeah, I forgot all about that.
    I wish Google had both "reply" links quote.

    (and look, people CAN remind me nicely...go figure)

    Actually, I wish I had Gravity and a news server back, but the new job,
    she blocks news servers and downloads.

    > > Grab a few that are easy to modify for FF use and modify them.

    >
    > In order to know what is "easy to modify for FF" it requires a level of
    > understanding that you wouldn't need to find copy/paste scripts, you
    > would already know how to write your own.


    This is true.
    And kind of what I was getting at, really.

    > > Or go to dynamicdrive.com and make sure you look specifically for
    > > cross-browser scripts.

    >
    > Dynamic Drive is just as bad, if not worse, than either of the ones
    > mentioned.


    Oh, I don't know.
    It has some bad stuff, but I like a few of their cross-browser scripts.
    Then again, some people are really picky. ;)

    How about posting links to sites you think are good, then?
    nikki, Oct 3, 2005
    #6
  7. bert76

    Randy Webb Guest

    said the following on 10/3/2005 4:34 PM:

    > bert76 wrote:
    >
    >>time and again you have to try out, test it only to
    >>find it only works in IE.

    >
    >
    > A big part of the problem, I think, is that so much of what you find on
    > the web are hacks, instead of good well-written code. Most of it was
    > probably written years ago too. Take for example this:
    >
    > <html>
    > <head>
    > <script>function a (){ alert(t.i.value) }</script>
    > </head>
    > <body>
    > <form name="t"><input name="i" onchange="a()"></form>
    > </body>
    >
    > that works, but it's not valid html. If you change <html> to this:
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml">
    >
    > then suddenly that code wont work. It wont work because it was invalid
    > all along - I'm supposed to use document.getElementById("i"), but if I
    > was just throwing together a hack for a tips website, maybe I wouldn't
    > care.


    No, you don't use getElementById to gain access to a form by its name.
    You use the forms collection:

    document.forms['formNAME'].elements['elementNAME'].value;

    You went from one IE-only example to another IE-only example.

    > So you see, the problem isn't really compatibility. It's often
    > validity.


    No, it's im/proper accessing that is the problem, along with validity
    but more times than not, its crappy script writing.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Oct 3, 2005
    #7
  8. bert76

    Randy Webb Guest

    nikki said the following on 10/3/2005 4:51 PM:

    > Randy Webb wrote:
    >
    >>nikki said the following on 10/3/2005 3:31 PM:
    >>
    >>
    >>Please quote what you are replying to, it makes following the
    >>conversation easier.
    >>

    >
    >
    > Yeah, I forgot all about that.
    > I wish Google had both "reply" links quote.
    >
    > (and look, people CAN remind me nicely...go figure)


    I wish this were already in the FAQ though, it seems to be a major
    problem for Google users:

    <FAQENTRY>
    If you want to post a followup via groups.google.com, don't use
    the "Reply" link at the bottom of the article. Click on "show
    options" at the top of the article, then click on the "Reply" at
    the bottom of the article headers.
    </FAQENTRY>

    > Actually, I wish I had Gravity and a news server back, but the new job,
    > she blocks news servers and downloads.
    >
    >
    >>>Grab a few that are easy to modify for FF use and modify them.

    >>
    >>In order to know what is "easy to modify for FF" it requires a level of
    >>understanding that you wouldn't need to find copy/paste scripts, you
    >>would already know how to write your own.

    >
    >
    > This is true.
    > And kind of what I was getting at, really.
    >
    >
    >>>Or go to dynamicdrive.com and make sure you look specifically for
    >>>cross-browser scripts.

    >>
    >>Dynamic Drive is just as bad, if not worse, than either of the ones
    >>mentioned.

    >
    >
    > Oh, I don't know.
    > It has some bad stuff, but I like a few of their cross-browser scripts.
    > Then again, some people are really picky. ;)
    >
    > How about posting links to sites you think are good, then?
    >


    Personally, I have the same opinion that Jim Ley has. I don't like
    canned copy/paste scripts. I would rather write a specific script for a
    specific case.

    But that aside, I honestly don't know of any "good" sites that have
    copy/paste scripts.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Oct 3, 2005
    #8
  9. wrote:
    > bert76 wrote:
    >> time and again you have to try out, test it only to
    >> find it only works in IE.

    >
    > A big part of the problem, I think, is that so much of what
    > you find on the web are hacks, instead of good well-written
    > code. Most of it was probably written years ago too.


    > Take for example this:
    >
    > <html>
    > <head>
    > <script>function a (){ alert(t.i.value) }</script>
    > </head>
    > <body>
    > <form name="t"><input name="i" onchange="a()"></form>
    > </body>


    As HTML 4 transitional the only invalid aspects of that mark-up appear
    to be the absence of a TITLE element and a missing TYPE attribute in the
    SCRIPT element. Neither of those errors would impact upon the behaviour
    of the script in any real-world browsers.

    > that works,


    Well, it doesn't. Assuming that a named form will be made available as a
    named property of the global object is a bad habit aquifer because it is
    true of IE browsers. It was never true of a significant proportion of
    other browsers. That script never would have worked in a Netscape
    browser, for example.

    > but it's not valid html. If you change <html> to this:
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml">


    That is seriously disingenuous. Asking any script to survive the
    transition from HTML to XHTML is very optimistic, as the XHTML DOM
    requires a style of scripting that is very distinct from that required
    for an HTML DOM. Asking HTML mark-up to successfully pass through an XML
    parser is totally unrealistic.

    > then suddenly that code wont work.


    Given that the original script was aimed at proprietary features of IE's
    object model, and IE doesn't support/render XHTML at all, that isn't a
    particularly unexpected change, though very few non-trivial scripts
    would survive the transition form an HTML DOM to an XHTML DOM anyway.

    > It wont work because it was
    > invalid all along -


    The invalidity in the original is not a factor in determining whether
    that script would work or not.

    > I'm supposed to use document.getElementById("i"),


    There are no elements in the original mark-up that have the ID "i", so
    that would not be a useful change to make. The W3C HTML DOM specified
    (and very back-compatible) - document.forms - collection is the place to
    look-up forms by name (and/or ID, in W3C DOM implementations), and the -
    elements - collection of the form is the place to look-up named (and/or
    IDed, in W3C DOM implementations) form controls.

    <snip>
    > So you see, the problem isn't really compatibility.
    > It's often validity.


    You haven't made your point at all. There are plenty of opportunities to
    demonstrate invalid mark-up (particularly structurally invalid mark-up)
    having a detrimental impact upon the scripted interaction with the
    resulting DOM, particularly around the invalid placement of forms within
    TABLE elements, but this 'example' is most likely to detract from a
    case for the use of valid mark-up.

    Richard.
    Richard Cornford, Oct 3, 2005
    #9
  10. bert76 a écrit :
    > can anyone suggest a couple of websites providing *compatible*
    > javascript?


    The thing is if you use web standards compliant DOM attributes and
    methods, chances are your webpage will be working as expected on all
    modern browsers.

    > of course there is
    > http://javascript.internet.com/


    Deprecated, rusted pages, full of invalid markup code and invalid CSS
    code, full of poor, wrong coding practices, etc..

    > http://javascriptkit.com/
    > and the likes, but time and again you have to try out, test it only to
    > find it only works in IE.


    Yep.

    > at school, we want to test a number of javascripts, preferably
    > compatible with *all* browsers (mainly, but not just firefox).
    > tnx for suggestions
    >



    Using Web Standards in Your Web Pages
    (in particular the dom access section)
    http://www.mozilla.org/docs/web-developer/upgrade_2.html

    Mozilla Web Author FAQ
    http://www.mozilla.org/docs/web-developer/faq.html

    http://www.digital-web.com/articles/preparing_for_standard_compliant_browsers_part1/
    http://www.digital-web.com/articles/preparing_for_standard_compliant_browsers_part2/

    Making your web page compatible with Mozilla
    (will show some differences in supported event object models)
    http://www.reloco.com.ar/mozilla/compat.html

    My website:
    http://www.gtalbot.org/DHTMLSection/
    will work for all modern browsers, although I have used hacks to
    workaround incompatibilities

    Gérard
    --
    remove blah to email me
    Gérard Talbot, Oct 6, 2005
    #10
    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. trint
    Replies:
    3
    Views:
    387
    bruce barker
    Sep 30, 2007
  2. pantagruel
    Replies:
    0
    Views:
    217
    pantagruel
    Feb 17, 2006
  3. Java Guy
    Replies:
    3
    Views:
    103
  4. DanWeaver

    Browser cross compatible javascript

    DanWeaver, Mar 20, 2008, in forum: Javascript
    Replies:
    2
    Views:
    87
    DanWeaver
    Mar 25, 2008
  5. revek
    Replies:
    15
    Views:
    151
    Thomas 'PointedEars' Lahn
    Feb 2, 2009
Loading...

Share This Page