works in Opera and IE but not FF or Chrome - why?

Discussion in 'Javascript' started by 123Jim, May 7, 2011.

  1. 123Jim

    123Jim Guest

    123Jim, May 7, 2011
    #1
    1. Advertising

  2. 123Jim

    Evertjan. Guest

    123Jim wrote on 07 mei 2011 in comp.lang.javascript:

    > Hi all, Please take a look at my test page, why does it work in Opera
    > and IE but not in Firefox or Chrome?
    >
    > http://myweb.tiscali.co.uk/ladycroft/webdevfun/drag_and_drop_javascript
    > .html


    You do not specify what you want it to do.

    Looking at the code:

    <style>
    <!--
    ..dragme{position:relative;}
    -->
    </style>

    <script language="JavaScript1.2">
    <!--


    Wow, that is code of last century,
    better learn some Javascript by perusing the NG-faq and the NG-content.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., May 7, 2011
    #2
    1. Advertising

  3. 123Jim

    123Jim Guest

    "Evertjan." <> wrote in message
    news:Xns9EDED39BE4402eejj99@194.109.133.242...
    > 123Jim wrote on 07 mei 2011 in comp.lang.javascript:
    >
    >> Hi all, Please take a look at my test page, why does it work in Opera
    >> and IE but not in Firefox or Chrome?
    >>
    >> http://myweb.tiscali.co.uk/ladycroft/webdevfun/drag_and_drop_javascript
    >> .html

    >
    > You do not specify what you want it to do.
    >
    > Looking at the code:
    >
    > <style>
    > <!--
    > .dragme{position:relative;}
    > -->
    > </style>
    >
    > <script language="JavaScript1.2">
    > <!--
    >
    >
    > Wow, that is code of last century,
    > better learn some Javascript by perusing the NG-faq and the NG-content.
    >
    >


    Turns out the code did not work in FF and Chrome because they did not like
    my choice of the strict 4.01 doctype (for this code) .. There may be other
    problems in the code but it now seems to work fine in the four browsers I
    tested.
    123Jim, May 8, 2011
    #3
  4. On May 8, 4:15 pm, "123Jim" <> wrote:

    > Turns out the code did not work in FF and Chrome because they did not like
    > my choice of the strict 4.01 doctype (for this code) .. There may be other
    > problems in the code but it now seems to work fine in the four browsers I
    > tested.


    You've got it backwards, they didn't like the errors in the code.

    With the Doctype you trigger Standards mode, and browsers follow the
    specifications more precisely. I'm not going to fully debug that pre-
    millennial code, but one obvious problem is that it tries to set
    integer values to the left and top properties - but they take lengths,
    but must have units if they have a value other than 0.

    --
    David Dorward
    http://dorward.me.uk/
    David Dorward, May 8, 2011
    #4
  5. 123Jim

    Evertjan. Guest

    123Jim wrote on 08 mei 2011 in comp.lang.javascript:

    > "Evertjan." <> wrote in message
    > news:Xns9EDED39BE4402eejj99@194.109.133.242...
    >> 123Jim wrote on 07 mei 2011 in comp.lang.javascript:
    >>
    >>> Hi all, Please take a look at my test page, why does it work in
    >>> Opera and IE but not in Firefox or Chrome?
    >>>
    >>> http://myweb.tiscali.co.uk/ladycroft/webdevfun/drag_and_drop_javascri
    >>> pt .html

    >>
    >> You do not specify what you want it to do.
    >>
    >> Looking at the code:
    >>
    >> <style>
    >> <!--
    >> .dragme{position:relative;}
    >> -->
    >> </style>
    >>
    >> <script language="JavaScript1.2">
    >> <!--
    >>
    >> Wow, that is code of last century,
    >> better learn some Javascript by perusing the NG-faq and the
    >> NG-content.

    >
    > Turns out the code did not work in FF and Chrome because they did not
    > like my choice of the strict 4.01 doctype (for this code) .. There may
    > be other problems in the code but it now seems to work fine in the
    > four browsers I tested.


    Perhaps, but aren't you interested in the "why"?

    And don't you want code that does not lead you to unexpected surprises to
    users that perhaps won't report back to you?


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., May 8, 2011
    #5
  6. 123Jim

    123Jim Guest

    "Evertjan." <> wrote in message
    news:Xns9EDFC559DC90Ceejj99@194.109.133.242...
    > 123Jim wrote on 08 mei 2011 in comp.lang.javascript:
    >
    >> "Evertjan." <> wrote in message
    >> news:Xns9EDED39BE4402eejj99@194.109.133.242...
    >>> 123Jim wrote on 07 mei 2011 in comp.lang.javascript:
    >>>
    >>>> Hi all, Please take a look at my test page, why does it work in
    >>>> Opera and IE but not in Firefox or Chrome?
    >>>>
    >>>> http://myweb.tiscali.co.uk/ladycroft/webdevfun/drag_and_drop_javascri
    >>>> pt .html
    >>>
    >>> You do not specify what you want it to do.
    >>>
    >>> Looking at the code:
    >>>
    >>> <style>
    >>> <!--
    >>> .dragme{position:relative;}
    >>> -->
    >>> </style>
    >>>
    >>> <script language="JavaScript1.2">
    >>> <!--
    >>>
    >>> Wow, that is code of last century,
    >>> better learn some Javascript by perusing the NG-faq and the
    >>> NG-content.

    >>
    >> Turns out the code did not work in FF and Chrome because they did not
    >> like my choice of the strict 4.01 doctype (for this code) .. There may
    >> be other problems in the code but it now seems to work fine in the
    >> four browsers I tested.

    >
    > Perhaps, but aren't you interested in the "why"?
    >
    > And don't you want code that does not lead you to unexpected surprises to
    > users that perhaps won't report back to you?
    >



    Affirmative ..
    Currently I'm looking at this:
    http://www.jslint.com/
    123Jim, May 8, 2011
    #6
  7. 123Jim

    123Jim Guest

    "David Dorward" <> wrote in message
    news:...
    On May 8, 4:15 pm, "123Jim" <> wrote:

    >> Turns out the code did not work in FF and Chrome because they did not
    >> like
    >> my choice of the strict 4.01 doctype (for this code) .. There may be
    >> other
    >> problems in the code but it now seems to work fine in the four browsers I
    >> tested.


    >You've got it backwards, they didn't like the errors in the code.


    >With the Doctype you trigger Standards mode, and browsers follow the
    >specifications more precisely. I'm not going to fully debug that pre-
    >millennial code, but one obvious problem is that it tries to set
    >integer values to the left and top properties - but they take lengths,
    >but must have units if they have a value other than 0.



    Agreed . .I'll look into it
    123Jim, May 8, 2011
    #7
    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. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,744
    Smokey Grindel
    Dec 2, 2006
  2. Øyvind Granberg

    iframe in ie & ff & Chrome & Opera

    Øyvind Granberg, Dec 5, 2008, in forum: HTML
    Replies:
    5
    Views:
    11,821
    Øyvind Granberg
    Dec 6, 2008
  3. garey
    Replies:
    1
    Views:
    110
    Thomas 'PointedEars' Lahn
    Apr 30, 2009
  4. albert kao
    Replies:
    4
    Views:
    167
  5. Nooner Lenovo
    Replies:
    9
    Views:
    496
    Hot-Text
    Aug 10, 2012
Loading...

Share This Page