Some unknown browsers fail to calculate my JavaScript code.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cardman

    #16
    Re: Some unknown browsers fail to calculate my JavaScript code.

    On Sun, 01 Feb 2004 13:35:20 GMT, Michael Winter
    <M.Winter@bluey onder.co.invali d> wrote:
    [color=blue]
    >That doesn't really mean anything. There are plenty of web developers out
    >there that have various qualifications, and get paid to produce websites.
    >However, they too still come out with rubbish that violates guidelines of
    >good web design.[/color]

    The problem in that case would be browsers who allow such poor design
    to work, when even Netscape once allowed direct Java function calls
    from JavaScript.
    [color=blue]
    >You can't just put up a site that says, "It's safe to use JavaScript with
    >my site. I promise that I won't abuse it", and expect people to
    >immediately re-enable JavaScript. If they want to leave it disabled, you
    >should design to cope with that. As I'll point out later, you don't.[/color]

    They don't even have to bother with HTML at all, when you can still
    view it as pure text. Most people do not go to such extremes, when
    they would be crazy.
    [color=blue]
    >JavaScript isn't important to the Web.[/color]

    Funny how just about every web site uses it. And that even includes
    Microsoft and IBM I see.
    [color=blue]
    >Sites that use pure HTML Strict can
    >operate just fine without it, if designed correctly. The problem is that
    >most sites are designed badly, with overuse of JavaScript, so JavaScript
    >support in browsers is important.[/color]

    Since there is not much to fear about JavaScript, when say it does not
    even support file functions, then the only real problem are those
    people who use it for say window popups.
    [color=blue][color=green][color=darkred]
    >>> Most of the time, people that post to this group don't have a choice:
    >>> they use hosts that don't have the option of server-side scripting.[/color]
    >>
    >> Too cheap to buy some real hosting? ;-][/color]
    >
    >Never heard of personal pages?[/color]

    Sure, but have you ever heard of don't look a gift horse in the mouth?

    They want to do all that CGI/Pearl/Databases stuff, then they should
    get themselves a real web site. After all they are sure to get much
    better support and services as well.

    You get what you pay for in other words, which explains my above
    statement.

    Since I am here and you are recommending not using JavaScript, then I
    wonder what ever happened to Netscape's server-side JavaScript
    processing system that was called LiveWire?
    [color=blue][color=green]
    >> I take it that you have not seen my site, when I don't even use
    >> frames. And for note my site is not dependant on JavaScript, when it
    >> just makes everyone's lives a whole lot easier.[/color]
    >
    >Yes, it is. Without JavaScript, your site is useless.[/color]

    Well I did consider long and hard if I should turn over my main menu
    to JavaScript control, where when I did so I did not even have a
    single complaint.

    If you know of an alternate option, then I would be interested in
    hearing it.
    [color=blue]
    >The start page
    >contains a lot of text, language translation links, and on-line payment
    >service links. Nothing else.[/color]

    No menu in other words.
    [color=blue]
    >To actually see the items you sell, I have to
    >enable JavaScript,[/color]

    To get the menu.
    [color=blue]
    >and there is nothing on your site that states that this is required.[/color]

    True, where maybe I should have added that when I moved the menu
    control over.
    [color=blue]
    >As I stated earlier, you can have as many qualifications as
    >you like, but it doesn't mean that what you produce will always be
    >considered "good design".[/color]

    And different people have different views. I believe that the correct
    answer is that JavaScript has just been superceeded by better
    languages.
    [color=blue]
    >So damn anyone else because they don't like Microsoft's products (with
    >good reason)?[/color]

    My site works just fine in Netscape and most over popular browsers as
    well. Anyway not using such good browsers, or which there a many,
    would be recommended to get a better browser.

    I remember years also that I had to tell one person to upgrade their
    browser version, due to missing text, when they were still sorting out
    HTML at the time.

    So should I not use certainly features in HTML due to old obsolete
    browser versions?
    [color=blue][color=green]
    >> And that is why I do things like ensuring that at least one of my
    >> three prices is displayed if JavaScript is off.[/color]
    >
    >[snip]
    >
    >And as I pointed out a moment ago, without JavaScript, they won't get
    >anywhere near those prices.[/color]

    Well, turning the menu back over to HTML is not an option, where I
    have yet to discover a better option.
    [color=blue]
    >Even if you don't have the time - make it.[/color]

    Customers be damned then.
    [color=blue]
    >You *do* need to start your site again from scratch.[/color]

    The only real issues on my site as it exists would be the main menu
    and the EUR and USD values.

    Also, I do not see that it is helpful to say "start your site again
    from scratch" simply because it does not match your favoured design,
    when at most only a couple of changes need to be done.

    Sure, I have huge plans for what I would like to do with my site, but
    I only have to time to move slowly in that direction.
    [color=blue]
    >Unless, of course, you just want to give the
    >finger to that small minority of people you obviously care so little about.[/color]

    All a matter of supply and demand to me, when by making the demand,
    then you will get the support.

    Maybe you should go and see how important JavaScript is to the Web,
    when most sites will not function well without it.

    I turned JavaScript off once, for some reason that I now forget, when
    it only took about two hours before I had no choice except to turn it
    back on again.

    Life is simple and easy with JavaScript, even if people these days
    need to get themselves a pop-up killer application.

    Cardman


    Comment

    • Jim Ley

      #17
      Re: Some unknown browsers fail to calculate my JavaScript code.

      On Sun, 01 Feb 2004 19:19:19 +0000, Cardman <do-not@spam-me.com>
      wrote:[color=blue]
      >Ah thanks, just what I need. Time to burn my useless 856 page
      >JavaScript manual that does not mention such useful things.[/color]

      Unless it's Flanagan Ed.4 I really would anyway, if it is that one,
      avoid the old parts - you'll need to buy Ed.3 and compare...
      [color=blue]
      >To an experienced programmer like myself dozens of languages come and
      >go all the time, where it is all about knowing enough to get the job
      >done. Highly efficient code, and knowing ever obscure fact, are for
      >those wanting to spend their life on the one language.[/color]

      Odd, all the experienced programmers I know tend to author highly
      efficient code in all the languages - perhaps not to the extent of
      knowing HTML DOM optimisations, but certainly knowing that functions
      and repeating code are bad.
      [color=blue]
      >Well I did and it failed, when I was not aware that (unlike any other
      >language that I have seen) you can join together text sections in
      >parenthesis to make your label name.[/color]

      I understood you were an experienced programmer with dozens of
      languages - such functionality is near universal in the scripting
      languages isn't it?
      [color=blue]
      >I have even lost Telnet access on my hosting in recent years simply
      >because some low life will use and abuse everything that they can.[/color]

      The fact you were ever using telnet suggests you needed to get some
      better experience, the fact you now decry the lack of it suggests you
      desperately need to get some more experience.
      [color=blue]
      >And larger inaccuracy, which would be the point of such a scheme,
      >would be very easy to spot, when I deal with my item prices all the
      >time.[/color]

      the problem comes with you accepting the order at the price they offer
      - a good lawyer would have little problem in forcing you to comply and
      even if not, do you really want the cost of fighting it?

      Jim.
      --
      comp.lang.javas cript FAQ - http://jibbering.com/faq/

      Comment

      • Cardman

        #18
        Re: Some unknown browsers fail to calculate my JavaScript code.

        On 1 Feb 2004 07:15:09 -0800, Lee <REM0VElbspamtr ap@cox.net> wrote:
        [color=blue]
        >It sounds like there's no way for you to know whether or not
        >that has ever been a problem. People might be cheating you
        >every day.[/color]

        Is there some purpose to this paranoia? Wanting to see me a new system
        or something?
        [color=blue][color=green]
        >>However, had my customers been trying to rip me off, then I would have
        >>known about it long ago. This problem is clearly too fixed within this
        >>one simple code section to be planned.[/color]
        >
        >How would you have known?[/color]

        I know my item prices. Not to forget that Order Forms are post
        processed into my spreadsheet tracking such facts.
        [color=blue]
        >The fact that you've identified what part of your code could
        >cause the same symptoms doesn't mean that it isn't somebody
        >spoofing you,[/color]

        And why would they clearly advertise this fact on their Order Form if
        it was true? When having a Total Item Weight of zero grams is a very
        easy thing to spot.

        One fact is that for Inland Recorded delivery I charge £2 at minimum,
        where the Total Package Weight would have to exceed 450 grams in order
        to increase the cost to £3.

        It would serve on purpose to manually set the Total Item Weight to
        zero grams for any real Total Package Weight of less than 450g, when
        the minimum postage cost will still be £2.

        Such errors that do not affect the Postage Cost are the most common
        occurrence of this problem that I see. In other words this problem
        occurs, but the end payment total is not affected at all.
        [color=blue]
        >particularly since there don't seem to be any
        >known browsers that would cause the problem you describe.[/color]

        Maybe I should go and ask these customers what they are using then,
        when there may indeed be a pattern.

        As mentioned this problem is not the customers doing it manually, when
        all signs point to this fact. Not to mention that trying to submit a
        such user modified false data to my hosting for on-line payment would
        be rendered close to impossible due to the PHP code.

        Cardman


        Comment

        • Cardman

          #19
          Re: Some unknown browsers fail to calculate my JavaScript code.

          On Sun, 01 Feb 2004 19:58:47 GMT, jim@jibbering.c om (Jim Ley) wrote:
          [color=blue]
          >On Sun, 01 Feb 2004 19:19:19 +0000, Cardman <do-not@spam-me.com>
          >wrote:[color=green]
          >>Ah thanks, just what I need. Time to burn my useless 856 page
          >>JavaScript manual that does not mention such useful things.[/color]
          >
          >Unless it's Flanagan Ed.4 I really would anyway, if it is that one,
          >avoid the old parts - you'll need to buy Ed.3 and compare...[/color]

          No, the one I have is titled "Using JavaScript Second Edition (Special
          Edition)". Other attached terms are "The Most Complete Reference" and
          "World's Best Selling Series".

          ISBN 0-7897-1138-9

          I will check out your recommended choice.
          [color=blue]
          >Odd, all the experienced programmers I know tend to author highly
          >efficient code in all the languages - perhaps not to the extent of
          >knowing HTML DOM optimisations, but certainly knowing that functions
          >and repeating code are bad.[/color]

          Certainly, but take my latest Order Form changes for example...


          I just removed a lot of the repeating text and reduced the file size
          by over 10k. Makes reading easier as well, but adding those loops now
          adds more processing time to it.

          In other words instead of one straight line it now does loops, which
          in the end makes program execution slower.

          I will have to see how I can optimise it further and make it even
          smaller and slower. And you may care to notice my lack of function
          calls during this new code, when pushing and popping to/from the stack
          sure does slow thing down.

          Just don't forget that when a program works, then that is the job
          done, where optimizing it just takes lots of time and effort to have
          that same job done slightly better.

          Since time is money, then large work on optimization is only needed
          when the project has space or speed constraints. You usually find that
          when trying to cram code into a microcontroller .
          [color=blue][color=green]
          >>I have even lost Telnet access on my hosting in recent years simply
          >>because some low life will use and abuse everything that they can.[/color]
          >
          >The fact you were ever using telnet suggests you needed to get some
          >better experience,[/color]

          Well Telnet is useful when your hosting provider messes up your
          hosting. Like one time when my FTP access was down, where I logged in
          through Telnet, made a Telnet connection to my second site, then
          downloaded the required files directly.
          [color=blue]
          >the fact you now decry the lack of it suggests you
          >desperately need to get some more experience.[/color]

          Telnet is a tool, where it is useful depending on what you want to do.

          I was thinking about Telnet recently wondering where my hosting
          provider kept the Perl files (my first use), where with Telnet access
          I could have answered that question myself, but now I will have to ask
          them.

          If you can name another method to search my hosting provider's server
          for lost files, then maybe I don't need Telnet after all. Except when
          my FTP or Admin access breaks down of course.
          [color=blue][color=green]
          >>And larger inaccuracy, which would be the point of such a scheme,
          >>would be very easy to spot, when I deal with my item prices all the
          >>time.[/color]
          >
          >the problem comes with you accepting the order at the price they offer[/color]

          Orders are only accepted when the correct payment has been made.
          [color=blue]
          >- a good lawyer would have little problem in forcing you to comply and
          >even if not, do you really want the cost of fighting it?[/color]

          Well that is a pointless example.

          If the user's system miscalculates the total, then they are obviously
          responsible for the inaccuracy.

          Cardman


          Comment

          • Jeff Thies

            #20
            Re: Some unknown browsers fail to calculate my JavaScript code.

            <snip>
            [color=blue]
            > Simple enough code you may think, but some browsers without doubt are
            > messing this up.[/color]

            I'm just a self taught mid level programmer, but that is not simple code.

            It's terribly convoluted and inefficient. It could easily be done in tenth
            of what you have.

            You shouldn't be using numerically index arrays at all. Something like this
            is far easier:

            var weightArray=['white':8.1,'p8 4':5.3...]

            I would call that a hash in perl.

            ditto for the descriptions.

            Then loop through the form and do the calculations. You really don't need
            tons of ifs

            And by all means server side check.

            Jeff



            [color=blue]
            >The most common result is that items have been
            > selected on the Order Form, but the Total Item Weight has been
            > incorrectly calculated as zero grams.
            >
            > One other problem that I noticed recently may go to help explain this
            > problem, when the Total Item Weight was lower than what it should have
            > been. After manually calculating the values, then all the item weight
            > lines had been included in the Total Item Weight calculation except
            > for the first line on the Order Form.
            >
            > Combined with previous things that I have seen before, then I suspect
            > what may be happening is as follows...
            >
            > A ten element JavaScript array should be created as...
            > 0,1,2,3,4,5,6,7 ,8,9
            >
            > However, the faulty browsers may be creating their ten element array
            > like this instead...
            > 1,2,3,4,5,6,7,8 ,9,10
            >
            > That if true could explain why my Total Item Weight is being
            > calculated incorrectly, when writes to and reading from element zero
            > would result in a lost value.
            >
            > My first question would be if there are any known faulty browsers who
            > create arrays like this?
            >
            > Should this not be the problem, then I am again stumped, when I would
            > not have a clue why this simple code is failing on some browsers.
            >
            > The only other aspect I can think of is if this page is exited and
            > then returned to, when who can say if all the values are restored?
            >
            > If it is true, then that also poses the problem of what to do to fix
            > it, when it is a little tricky to know the structure of the array
            > before you come to use it.
            >
            > I think that I may be able to create larger arrays if needed and start
            > from position one instead of zero, but I would have to see if this can
            > work out.
            >
            > Anyway, if anyone has a clue what is going on, then such a mention
            > would be much appreciated, when I am now getting very annoyed at how
            > the Postal Charge sometimes gets under valued.
            >
            > Thanks,
            >
            > Cardman
            > http://www.cardman.com
            > http://www.cardman.co.uk[/color]


            Comment

            • Michael Winter

              #21
              Re: Some unknown browsers fail to calculate my JavaScript code.

              On Sun, 01 Feb 2004 19:59:23 +0000, Cardman <do-not@spam-me.com> wrote:
              [color=blue]
              > On Sun, 01 Feb 2004 13:35:20 GMT, Michael Winter
              > <M.Winter@bluey onder.co.invali d> wrote:[/color]

              [snip]
              [color=blue][color=green]
              >> JavaScript isn't important to the Web.[/color]
              >
              > Funny how just about every web site uses it. And that even includes
              > Microsoft and IBM I see.[/color]
              [moved][color=blue]
              > Maybe you should go and see how important JavaScript is to the Web,
              > when most sites will not function well without it.[/color]

              Just because many sites, including those of well-known businesses, use
              JavaScript doesn't make it important to the Web. That just means that it's
              popular and over-used. The two things that make the Web are mark-up
              languages and style sheets. Those two, by themselves, provide both the
              content and the presentation. JavaScript provides some dynamic content and
              interaction, but it certainly can be done without, particularly if you
              allow for server-side scripting. Other technologies can provide
              interaction more reliably, and look better doing it, too.

              [snip]
              [color=blue][color=green]
              >> Without JavaScript, your site is useless.[/color]
              >
              > Well I did consider long and hard if I should turn over my main menu
              > to JavaScript control, where when I did so I did not even have a
              > single complaint.
              >
              > If you know of an alternate option, then I would be interested in
              > hearing it.[/color]

              Tomorrow, if I have the time, I will recreate your front page using only
              HTML and CSS. There won't be a single script statement in the document.

              Mike

              --
              Michael Winter
              M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

              Comment

              • Cardman

                #22
                Re: Some unknown browsers fail to calculate my JavaScript code.

                On Sun, 01 Feb 2004 23:56:44 GMT, Michael Winter
                <M.Winter@bluey onder.co.invali d> wrote:
                [color=blue]
                >Just because many sites, including those of well-known businesses, use
                >JavaScript doesn't make it important to the Web.[/color]

                One reason why it is "important to the web" is that, not unlike HTML,
                it is easy for use. Kind of like a baby language that you can slap
                around and it keeps on ticking.

                Since it is an easy for new site owners to start doing useful things
                with, then it is an important level between HTML and the much more
                powerful languages.

                Without JavaScript, then most web pages would not do anything beyond
                moving from one page to the next, when most other popular web
                languages (like Perl and CGI) are much harder to start off with.
                [color=blue]
                >That just means that it's popular and over-used.[/color]

                And not respected it seems. As you must admit that it gets the job
                done, where that is what really counts here.
                [color=blue]
                >The two things that make the Web are mark-up
                >languages and style sheets. Those two, by themselves, provide both the
                >content and the presentation.[/color]

                Yes, just like reading a book.
                [color=blue]
                >JavaScript provides some dynamic content and
                >interaction, but it certainly can be done without,[/color]

                My automatic Order Form does a wealth of features all on the single
                page, where it guides, calculates, formats, displays, warns, validates
                and finally prints.

                My customers can make no real errors on my Order Forms, when it
                handles as much of the work for them as is possible.
                [color=blue]
                >particularly if you allow for server-side scripting.[/color]

                Well something has to do the calculation, but I am sure that involves
                moving to multiple pages.

                If I ever desire going that far, then it is time for the whole
                shopping basket and customer database thing.
                [color=blue]
                >Other technologies can provide
                >interaction more reliably, and look better doing it, too.[/color]

                Look better? My Order Form is not exactly ugly, but you do even have
                those annoying flash intros these days.
                [color=blue][color=green]
                >> If you know of an alternate option, then I would be interested in
                >> hearing it.[/color]
                >
                >Tomorrow, if I have the time, I will recreate your front page using only
                >HTML and CSS. There won't be a single script statement in the document.[/color]

                That sounds incredibly cool, where I certainly hope that you do. Fix
                my EUR and USD price function at the same time, then my whole site is
                good once more.

                And yes I will even sort out my automatic Order Form one day, which I
                planned to do anyway, but rebuilding my entire ordering process from
                scratch at this time is not the best idea.

                Cardman


                Comment

                • Richard Cornford

                  #23
                  Re: Some unknown browsers fail to calculate my JavaScript code.

                  "Cardman" <do-not@spam-me.com> wrote in message
                  news:mfgq101735 gco89ob7i4vvb32 v3kirecb7@4ax.c om...
                  <snip>[color=blue]
                  >Ah well my brother wrote the PHP code, where I have only
                  >briefly modified it. Since I have never seen a PHP manual,
                  >then I am not even sure what it can do, including the basics
                  >like functions and procedures.[/color]

                  PHP is capable of many things but one thing that it is really good at is
                  dynamically generating HTML.
                  [color=blue][color=green]
                  >>but it is also invalid HTML 4 as SCRIPT elements
                  >>(even with type attributes) are not allowed to be
                  >>children/descendants of SELECT elements in any of
                  >>the HTML 4 DTDs.[/color]
                  >
                  > Well it worked. :-][/color]

                  It is not so much a matter of whether what you have done works as
                  expected in the browsers in which you have tested it. It is a design
                  principal for cross-browser scripting: only valid HTML justifies the
                  expectation that the browser will create the expected DOM with that
                  HTML.
                  [color=blue]
                  >I can always move the select elements into the JavaScript code
                  >as well if that would please you? Or are forms also an issue?[/color]

                  The PHP should be assembling the SELECT element and its contents.

                  <snip>[color=blue][color=green]
                  >><URL: http://jibbering.com/faq/#FAQ4_39 >[/color]
                  >
                  >Ah thanks, just what I need. Time to burn my useless 856 page
                  >JavaScript manual that does not mention such useful things.[/color]

                  It is astounding how many inadequate (and often actively bad) JavaScript
                  books there are. Given that JavaScript is an object based language
                  designed to script arbitrary object models it if frankly perverse for
                  books on the subject not to cover both of the languages property
                  accessor syntaxes.

                  <snip>[color=blue]
                  >To an experienced programmer like myself dozens of languages
                  >come and go all the time, where it is all about knowing enough
                  >to get the job done. Highly efficient code, and knowing ever
                  >obscure fact, are for those wanting to spend their life on the
                  >one language.[/color]

                  To be honest, judging by the structure of the original code on your
                  order form and some of the logic you apply to your reasoning, I would
                  not have believed that you were an experienced programmer.

                  As languages go JavaScript is relatively small, because it relies on the
                  object model being scripted to provide the functionality that is needed
                  in its environment. It is learning the object models that takes time,
                  JavaScript is sufficiently defined in the 170 pages of the ECMA
                  specification.

                  <snip>[color=blue]
                  >I would have created it myself like linking these labels
                  >to a pointer based array, but then JavaScript is not that
                  >advanced.[/color]

                  What are you expecting to be able to do with a pointer that cannot be
                  done with an object reference?

                  <snip>[color=blue][color=green]
                  >>Your current code will accept fractional quantities[/color]
                  >
                  >Except that all the numbers that it makes use of are whole numbers.[/color]
                  <snip>

                  Not if the user enters a fraction in the quantity field. (and don't
                  forget that your reasoning for doing all of these calculations was
                  because the users cannot do the maths for themselves reliably, so you
                  should equally suspect them of entering meaningless values in the
                  quantity field.)

                  Richard.


                  Comment

                  • Cardman

                    #24
                    Re: Some unknown browsers fail to calculate my JavaScript code.

                    On Mon, 2 Feb 2004 01:49:04 -0000, "Richard Cornford"
                    <Richard@litote s.demon.co.uk> wrote:
                    [color=blue]
                    >"Cardman" <do-not@spam-me.com> wrote in message
                    >news:mfgq10173 5gco89ob7i4vvb3 2v3kirecb7@4ax. com...
                    ><snip>[color=green]
                    >>Ah well my brother wrote the PHP code, where I have only
                    >>briefly modified it. Since I have never seen a PHP manual,
                    >>then I am not even sure what it can do, including the basics
                    >>like functions and procedures.[/color]
                    >
                    >PHP is capable of many things but one thing that it is really good at is
                    >dynamically generating HTML.[/color]

                    I see. Like my Item Codes select list.
                    [color=blue][color=green]
                    >> Well it worked. :-][/color]
                    >
                    >It is not so much a matter of whether what you have done works as
                    >expected in the browsers in which you have tested it. It is a design
                    >principal for cross-browser scripting: only valid HTML justifies the
                    >expectation that the browser will create the expected DOM with that
                    >HTML.[/color]

                    True, but anything that can run on all the most popular browsers
                    cannot be that bad. Still, as you point out changing this section will
                    increase support, which is why that makes a good reason to do it.
                    [color=blue][color=green]
                    >>I can always move the select elements into the JavaScript code
                    >>as well if that would please you? Or are forms also an issue?[/color]
                    >
                    >The PHP should be assembling the SELECT element and its contents.[/color]

                    Then I may soon have it doing just that, but I can begin to foresee
                    one problem with this idea.

                    As I have always kept an eye on the size of my files, when people with
                    a slow modem would spend about half a minute downloading my Order Form
                    as it is.

                    By having PHP take control of the building of these sections, then the
                    file when sent to the user will now be ***huge***. Since JavaScript is
                    already important to the working of this page, then maybe JavaScript
                    should maintain control of this building.

                    I will think about that for a while before deciding, but I can see
                    more reasons to keep it with JavaScript than to move to PHP. Tough
                    one, when there are good reasons both ways.
                    [color=blue][color=green]
                    >>Ah thanks, just what I need. Time to burn my useless 856 page
                    >>JavaScript manual that does not mention such useful things.[/color]
                    >
                    >It is astounding how many inadequate (and often actively bad) JavaScript
                    >books there are. Given that JavaScript is an object based language
                    >designed to script arbitrary object models it if frankly perverse for
                    >books on the subject not to cover both of the languages property
                    >accessor syntaxes.[/color]

                    Then that should remind you that most experts cannot know everything,
                    which was obviously unhelpful in my case.

                    Some of my even older books have a section at the back containing
                    several blank lined pages, which was intended for their readers to
                    note down any missing details or their own useful solutions.

                    And certainly in more then a few books I have had to debug some of
                    their code examples.

                    In fact I do even recall a couple of books that appear to have been
                    created by some very odd authors, where their code examples had just
                    plain bad structuring.
                    [color=blue]
                    ><snip>[color=green]
                    >>To an experienced programmer like myself dozens of languages
                    >>come and go all the time, where it is all about knowing enough
                    >>to get the job done. Highly efficient code, and knowing ever
                    >>obscure fact, are for those wanting to spend their life on the
                    >>one language.[/color]
                    >
                    >To be honest, judging by the structure of the original code on your
                    >order form[/color]

                    It was not well optimised, but then you know the reason for that.
                    [color=blue]
                    >and some of the logic you apply to your reasoning,[/color]

                    Oh? Just what it that? As it still does exactly the same as it did
                    before, where I have just improved the error checking somewhat.
                    [color=blue]
                    >I would not have believed that you were an experienced programmer.[/color]

                    Then obviously your assumption is wrong, when I am not just an
                    experienced programmer, but one that usually impresses the other
                    experienced programmers, not to forget my former lecturers.

                    One problem these days is that I do not do nearly as much coding as
                    what I used to do, due to now running an unrelated company, which is
                    why some languages have fallen out of favour, while other new
                    languages have gained favour.

                    I even once learned COBOL...
                    [color=blue]
                    >As languages go JavaScript is relatively small, because it relies on the
                    >object model being scripted to provide the functionality that is needed
                    >in its environment. It is learning the object models that takes time,
                    >JavaScript is sufficiently defined in the 170 pages of the ECMA
                    >specificatio n.[/color]

                    Then you need to point this out to book authors, when with 856 pages
                    they appear to have achieved less.
                    [color=blue]
                    ><snip>[color=green]
                    >>I would have created it myself like linking these labels
                    >>to a pointer based array, but then JavaScript is not that
                    >>advanced.[/color]
                    >
                    >What are you expecting to be able to do with a pointer that cannot be
                    >done with an object reference?[/color]

                    Just my favoured method of data access, where having a pointer to an
                    array allows myself and others direct memory access and to cut up and
                    move the data about however I please.
                    [color=blue][color=green]
                    >>Except that all the numbers that it makes use of are whole numbers.[/color]
                    ><snip>
                    >
                    >Not if the user enters a fraction in the quantity field.[/color]

                    The final value is rounded anyway, where decimals are not really a
                    problem.
                    [color=blue]
                    >(and don't
                    >forget that your reasoning for doing all of these calculations was
                    >because the users cannot do the maths for themselves reliably, so you
                    >should equally suspect them of entering meaningless values in the
                    >quantity field.)[/color]

                    That it certainly possible, but never once in all these years has any
                    customer ever sent me a form with such an error. So they are simply
                    not that lacking in intelligence, when they know that a number has to
                    be entered here.

                    For that lack of a valid reason, then I have now wasted another four
                    lines of code in adding error checking and rounding to this Qty value
                    in the line processing section. And that works well enough, but it is
                    still subject to issues if they enter like "100a".

                    Before I make my own "is it a numeric value?" function to solve this
                    small flaw, then I will see if one already exists.

                    Cardman


                    Comment

                    • Michael Winter

                      #25
                      Re: Some unknown browsers fail to calculate my JavaScript code.

                      On Mon, 02 Feb 2004 11:52:02 +0000, Cardman <do-not@spam-me.com> wrote:
                      [color=blue]
                      > On Mon, 2 Feb 2004 01:49:04 -0000, "Richard Cornford"
                      > <Richard@litote s.demon.co.uk> wrote:[/color]

                      [snip]
                      [color=blue][color=green]
                      >> It is not so much a matter of whether what you have done works as
                      >> expected in the browsers in which you have tested it. It is a design
                      >> principal for cross-browser scripting: only valid HTML justifies the
                      >> expectation that the browser will create the expected DOM with that
                      >> HTML.[/color]
                      >
                      > True, but anything that can run on all the most popular browsers
                      > cannot be that bad.[/color]

                      You'd be surprised how wrong things can go when attempting to use the DOM
                      with an invalid document. The tree can end up looking nothing like the
                      input HTML, making node traversal very difficult. It's always a wise idea
                      to use valid HTML, especially as there is no reason, other than ignorance
                      or laziness, to follow the specification.
                      [color=blue][color=green]
                      >> The PHP should be assembling the SELECT element and its contents.[/color]
                      >
                      > Then I may soon have it doing just that, but I can begin to foresee
                      > one problem with this idea.
                      >
                      > As I have always kept an eye on the size of my files, when people with
                      > a slow modem would spend about half a minute downloading my Order Form
                      > as it is.
                      >
                      > By having PHP take control of the building of these sections, then the
                      > file when sent to the user will now be ***huge***. Since JavaScript is
                      > already important to the working of this page, then maybe JavaScript
                      > should maintain control of this building.
                      >
                      > I will think about that for a while before deciding, but I can see
                      > more reasons to keep it with JavaScript than to move to PHP. Tough
                      > one, when there are good reasons both ways.[/color]

                      You do realise that when a browser requests a PHP page, that file is not
                      returned, don't you? The data returned is the result of parsing the
                      document. Moving to all PHP, using JavaScript purely for interaction (not
                      generation), will probably reduce the amount of data downloaded by the
                      user. The size of a PHP file is not necessarily proportional to the size
                      of the result.

                      [snip]

                      Mike

                      --
                      Michael Winter
                      M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

                      Comment

                      • Cardman

                        #26
                        Re: Some unknown browsers fail to calculate my JavaScript code.


                        On Mon, 02 Feb 2004 14:10:51 GMT, Michael Winter
                        <M.Winter@bluey onder.co.invali d> wrote:
                        [color=blue]
                        >On Mon, 02 Feb 2004 11:52:02 +0000, Cardman <do-not@spam-me.com> wrote:
                        >[color=green]
                        >> True, but anything that can run on all the most popular browsers
                        >> cannot be that bad.[/color]
                        >
                        >You'd be surprised how wrong things can go when attempting to use the DOM
                        >with an invalid document. The tree can end up looking nothing like the
                        >input HTML, making node traversal very difficult. It's always a wise idea
                        >to use valid HTML, especially as there is no reason, other than ignorance
                        >or laziness, to follow the specification.[/color]

                        Well, as you can see I have now fixed that issue, when now JavaScript
                        makes that whole section. I will soon do a PHP building version and
                        see how they compare.
                        [color=blue][color=green]
                        >> I will think about that for a while before deciding, but I can see
                        >> more reasons to keep it with JavaScript than to move to PHP. Tough
                        >> one, when there are good reasons both ways.[/color]
                        >
                        >You do realise that when a browser requests a PHP page, that file is not
                        >returned, don't you?[/color]

                        As I well understand that fact, then you misunderstood my point.
                        [color=blue]
                        >The data returned is the result of parsing the
                        >document. Moving to all PHP, using JavaScript purely for interaction (not
                        >generation), will probably reduce the amount of data downloaded by the
                        >user.[/color]

                        Er, wrong.

                        My Ordering Code select list is currently handled by JavaScript and
                        takes up 21 lines to build all 12 select lists. Or I guess you would
                        count that as 135 if you include the Order Code array.

                        Should I move this to PHP, then certainly the used code could make the
                        PHP file even less. However, as you point out the PHP file is not sent
                        to the user, when it has to be parsed first.

                        The result of that parsing will be that the Ordering Code select list
                        will be inserted into the HTML code 12 times. That means that the HTML
                        code will lose the existing 21/135 lines and gain another 1404 lines,

                        I have not counted how many lines the non-PHP code in the oftest.php3
                        file take up, but this could well be doubled or even tripled.

                        You can see why I am reluctant to have PHP build these sections, when
                        the file size will become huge and take ages for a user with a slow
                        modem to download.
                        [color=blue]
                        >The size of a PHP file is not necessarily proportional to the size
                        >of the result.[/color]

                        Yes, when those "results" are going to "balloon", which explains why I
                        had JavaScript handle these in the first place.

                        Ideas on how to transfer my long list of Ordering Codes just once
                        instead of 12 times would be welcome.

                        Cardman


                        Comment

                        • Lee

                          #27
                          Re: Some unknown browsers fail to calculate my JavaScript code.

                          Cardman said:[color=blue]
                          >
                          >On 1 Feb 2004 07:15:09 -0800, Lee <REM0VElbspamtr ap@cox.net> wrote:
                          >[color=green]
                          >>It sounds like there's no way for you to know whether or not
                          >>that has ever been a problem. People might be cheating you
                          >>every day.[/color]
                          >
                          >Is there some purpose to this paranoia? Wanting to see me a new system
                          >or something?[/color]

                          I'm trying to warn you about how you might be being ripped off.
                          If your pride gets in the way of your accepting a warning, I
                          guess that's not my problem.

                          [color=blue][color=green][color=darkred]
                          >>>However, had my customers been trying to rip me off, then I would have
                          >>>known about it long ago. This problem is clearly too fixed within this
                          >>>one simple code section to be planned.[/color]
                          >>
                          >>How would you have known?[/color]
                          >
                          >I know my item prices. Not to forget that Order Forms are post
                          >processed into my spreadsheet tracking such facts.[/color]

                          Fine. Do you check each price?

                          [color=blue]
                          >Such errors that do not affect the Postage Cost are the most common
                          >occurrence of this problem that I see. In other words this problem
                          >occurs, but the end payment total is not affected at all.[/color]

                          As I said earlier, it would be a good way to test your security.
                          If you catch the problem, you won't believe it's deliberate.
                          If you don't catch it, they can move on to changing prices.


                          [color=blue]
                          >As mentioned this problem is not the customers doing it manually, when
                          >all signs point to this fact.[/color]

                          You don't seem to have any signs. You've concocted an explanation
                          that requires that some browsers not support an array index of 0,
                          which seems much less likely than that somebody is playing with
                          your forms.
                          [color=blue]
                          >Not to mention that trying to submit a
                          >such user modified false data to my hosting for on-line payment would
                          >be rendered close to impossible due to the PHP code.[/color]

                          That would be what they were trying to find out, by submitting
                          forms with the weight changed. But, from what you've said
                          before, and from what I see in your form, I'm not convinced
                          that it would be difficult to slip false data past your code.

                          Comment

                          • Michael Winter

                            #28
                            Re: Some unknown browsers fail to calculate my JavaScript code.

                            On Mon, 02 Feb 2004 14:54:53 +0000, Cardman <do-not@spam-me.com> wrote:
                            [color=blue]
                            > On Mon, 02 Feb 2004 14:10:51 GMT, Michael Winter
                            > <M.Winter@bluey onder.co.invali d> wrote:
                            >[color=green]
                            >> On Mon, 02 Feb 2004 11:52:02 +0000, Cardman <do-not@spam-me.com> wrote:[/color][/color]

                            [snip]
                            [color=blue][color=green][color=darkred]
                            >>> I will think about that for a while before deciding, but I can see
                            >>> more reasons to keep it with JavaScript than to move to PHP. Tough
                            >>> one, when there are good reasons both ways.[/color]
                            >>
                            >> You do realise that when a browser requests a PHP page, that file is not
                            >> returned, don't you?[/color]
                            >
                            > As I well understand that fact, then you misunderstood my point.[/color]

                            I though you would, but at the time your reasoning didn't seem correct
                            (see next point).
                            [color=blue][color=green]
                            >> The data returned is the result of parsing the
                            >> document. Moving to all PHP, using JavaScript purely for interaction
                            >> (not
                            >> generation), will probably reduce the amount of data downloaded by the
                            >> user.[/color]
                            >
                            > Er, wrong.[/color]

                            Yes, I am. I didn't consider the fact that looping code will, in all
                            likelihood, be smaller than the several HTML elements it produces. My only
                            defense is that I'm in the middle of re-writing your front page, so I have
                            my mind on other things. :)

                            [snip]
                            [color=blue]
                            > You can see why I am reluctant to have PHP build these sections, when
                            > the file size will become huge and take ages for a user with a slow
                            > modem to download.[/color]

                            Yes, I can...
                            [color=blue][color=green]
                            >> The size of a PHP file is not necessarily proportional to the size
                            >> of the result.[/color]
                            >
                            > Yes, when those "results" are going to "balloon", which explains why I
                            > had JavaScript handle these in the first place.
                            >
                            > Ideas on how to transfer my long list of Ordering Codes just once
                            > instead of 12 times would be welcome.[/color]

                            ....which is probably why the typical shopping basket method is a good
                            idea. By limiting the total number of items displayed to those in a
                            particular catagory, you don't have to transfer as much data. Once the
                            user finalises the order, once again the total data is limited but this
                            time, it is to the items ordered.

                            There's no way to reduce the load if all stocked items are present at
                            once, unless you use JavaScript (which we're trying to avoid, if possible).

                            Sorry again for my mistake.

                            Mike

                            --
                            Michael Winter
                            M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

                            Comment

                            • Richard Cornford

                              #29
                              Re: Some unknown browsers fail to calculate my JavaScript code.

                              "Cardman" <do-not@spam-me.com> wrote in message
                              news:1sas109liu 976f91f5sjfrgbq qqk5v9i8o@4ax.c om...
                              <snip>[color=blue]
                              >True, but anything that can run on all the most
                              >popular browsers cannot be that bad.[/color]

                              The argument that says that what works on some large percentage of
                              browsers must be the right thing to do is the argument used for writing
                              IE only code. So not really part of the techniques for cross-browser
                              scritping.
                              [color=blue]
                              >Still, as you point out changing this section will
                              >increase support, which is why that makes a good
                              >reason to do it.[/color]

                              I can't say more than it may (possibly should) increase support. There
                              certainly are areas where the handling of invalid HTML 4 by some
                              browsers will diminish cross-browser script support but I don't know
                              whether using SCRIPT children in SELECT elements is one of them. Without
                              testing on every browser in existence (and that is well over 100, not
                              counting versions) it would not be possible to say for sure, but the
                              principal still stands.

                              <snip>[color=blue]
                              >As I have always kept an eye on the size of my files, when
                              >people with a slow modem would spend about half a minute
                              >downloading my Order Form as it is.[/color]

                              As it stands 3/4 of the order form file is JavaScript, which in
                              principal could be in a separate JS file and maybe not need to be
                              downloaded more than once. And, even as modified, the script remains
                              repetitive and could be further reduced in size. The HTML contains a
                              great deal of presentational mark-up which could be done with CSS, also
                              in an external file that may not need downloading more than once.

                              Consider your:-

                              <BIG><BIG><BIG> PURCHASE ORDER</BIG></BIG></BIG>

                              - as opposed to:-

                              <H1>PURCHASE ORDER</H1>

                              - with the CSS to give the same presentation. Half the size and a better
                              semantic description of the content.

                              <snip>[color=blue][color=green][color=darkred]
                              >>>Ah thanks, just what I need. Time to burn my useless 856
                              >>>page JavaScript manual that does not mention such useful
                              >>>things.[/color][/color][/color]
                              [color=blue][color=green]
                              >>It is astounding how many inadequate (and often actively bad)
                              >>JavaScript books there are. Given that JavaScript is an object
                              >>based language designed to script arbitrary object models it
                              >>if frankly perverse for books on the subject not to cover both
                              >>of the languages property accessor syntaxes.[/color]
                              >
                              >Then that should remind you that most experts cannot know
                              >everything, which was obviously unhelpful in my case.[/color]

                              Who says it is experts who write JavaScript books? The limiting factors
                              are the time required to plan and write the book and the willingness of
                              someone to publish the results, and the confidence on the part of the
                              author that what they are doing is worthwhile. But my experience is that
                              confidence in ones ability to script web browsers is more often the
                              result of not really perceiving the issues than the result of expertise.

                              <snip>[color=blue][color=green][color=darkred]
                              >>>To an experienced programmer like myself dozens of
                              >>>languages come and go all the time, where it is all
                              >>>about knowing enough to get the job done. Highly
                              >>>efficient code, and knowing ever obscure fact,
                              >>>are for those wanting to spend their life on the
                              >>>one language.[/color]
                              >>
                              >>To be honest, judging by the structure of the original
                              >>code on your order form[/color]
                              >
                              >It was not well optimised, but then you know the reason
                              >for that.[/color]

                              It wasn't a matter of whether it was optimised, or the evident limited
                              familiarity with JavaScript as a language or its application to browser
                              scripting. My impression was derived only form the design and resulting
                              structure of the code.
                              [color=blue][color=green]
                              >>and some of the logic you apply to your reasoning,[/color]
                              >
                              >Oh? Just what it that? As it still does exactly the
                              >same as it did before, where I have just improved the
                              >error checking somewhat.[/color]

                              You code was not an issue in that case. Because programmers need to
                              understand mechanical logic in order to do their job I expect to see
                              more evidence of an appreciation of logic (and its limitations) in their
                              reasoned arguments than I would from someone who's debating experience
                              was exclusively rhetorical.
                              [color=blue][color=green]
                              >>I would not have believed that you were an experienced
                              >>programmer.[/color]
                              >
                              >Then obviously your assumption is wrong, when I am not
                              >just an experienced programmer, but one that usually
                              >impresses the other experienced programmers, not to
                              >forget my former lecturers.[/color]

                              But would those former lecturers and other experienced programmers have
                              been impressed with the code you actually wrote for your order page
                              (even if they lacked any specific knowledge of JavaScript or its
                              application to a browser DOM)?

                              <snip>[color=blue][color=green]
                              >>As languages go JavaScript is relatively small, because it
                              >>relies on the object model being scripted to provide the
                              >>functionali ty that is needed in its environment. It is
                              >>learning the object models that takes time, JavaScript is
                              >>sufficientl y defined in the 170 pages of the ECMA
                              >>specification .[/color]
                              >
                              >Then you need to point this out to book authors, when with
                              >856 pages they appear to have achieved less.[/color]

                              Beyond making statements in a public forum (which obviously carry no
                              more weight than the audience choose to attach to them) there isn't a
                              great deal that I can do to influence the behaviour of the authors of
                              books on JavaScript.

                              <snip>[color=blue][color=green][color=darkred]
                              >>>I would have created it myself like linking these labels
                              >>>to a pointer based array, but then JavaScript is not that
                              >>>advanced.[/color]
                              >>
                              >>What are you expecting to be able to do with a pointer that
                              >>cannot be done with an object reference?[/color]
                              >
                              >Just my favoured method of data access, where having a pointer
                              >to an array allows myself and others direct memory access and
                              >to cut up and move the data about however I please.[/color]

                              Having written assembly language and C I much prefer languages where I
                              don't have to think about the location of items of data in particular
                              memory structures. It was always error prone and time consuming. But I
                              don't see how being able to do that with JavaScript would enable you to
                              do anything that you cannot already do (and probably more easily).
                              Except maybe something like reaching into a 32bit integer and directly
                              pulling out only, say, the lower byte. But that is not something that
                              you need to do in higher level languages.

                              The dynamic nature of JavaScript objects means that the ability to move
                              data about is already virtually unrestricted, you don't even have to
                              worry about the type of the data involved (beyond being aware of what
                              type it is).

                              So again, what is it that you think that you would want to do in the
                              order form code with a pointer that cannot be done in JavaScript with an
                              object reference (and probably easier).

                              <snip>[color=blue][color=green]
                              >>Not if the user enters a fraction in the quantity field.[/color]
                              >
                              >The final value is rounded anyway, where decimals are not
                              >really a problem.[/color]
                              <snip>

                              That is not really the point. You asserted that because the script had
                              been adequately tested the fault must lie with an unknown browser. I
                              proposed that adequate testing would have exposed the ability on the
                              part of the user to enter fractional quantities and that because the
                              script attempted to guarantee the integrity of the order the ability of
                              the user to enter fractional quantities would have been
                              corrected/handled (in some way, though I suspect that having the script
                              actively change the value in the quantity field is not the best
                              approach). So evidence that the testing was not adequate serves to
                              undermine the deduction that the problem lies with an unknown browser.

                              Richard.


                              Comment

                              • Cardman

                                #30
                                Re: Some unknown browsers fail to calculate my JavaScript code.

                                On 2 Feb 2004 06:48:57 -0800, Lee <REM0VElbspamtr ap@cox.net> wrote:
                                [color=blue]
                                >Cardman said:
                                >[color=green]
                                >>Is there some purpose to this paranoia? Wanting to sell me a new system
                                >>or something?[/color]
                                >
                                >I'm trying to warn you about how you might be being ripped off.
                                >If your pride gets in the way of your accepting a warning, I
                                >guess that's not my problem.[/color]

                                What you overlook is that for a very long time I have been monitoring
                                the security of my existing ordering system, which means that I well
                                know what is really going on.

                                Believe it or not, but my customers are not trying to defraud me,
                                where there is very little achieved in trying to do so.
                                [color=blue][color=green]
                                >>I know my item prices. Not to forget that Order Forms are post
                                >>processed into my spreadsheet tracking such facts.[/color]
                                >
                                >Fine. Do you check each price?[/color]

                                The purpose is more along the line of looking for inaccuracies in the
                                general bulk of orders. Yes, once it a while a problem is overlooked,
                                but mostly all problems are very easy to spot.
                                [color=blue][color=green]
                                >>Such errors that do not affect the Postage Cost are the most common
                                >>occurrence of this problem that I see. In other words this problem
                                >>occurs, but the end payment total is not affected at all.[/color]
                                >
                                >As I said earlier, it would be a good way to test your security.
                                >If you catch the problem, you won't believe it's deliberate.
                                >If you don't catch it, they can move on to changing prices.[/color]

                                And I could well change to recalculating the entire Order Form in PHP
                                before on-line submission and payment is done. However, nothing can be
                                done about orders received through the post, when indeed the
                                customer's system will always do that calculation.
                                [color=blue][color=green]
                                >>As mentioned this problem is not the customers doing it manually, when
                                >>all signs point to this fact.[/color]
                                >
                                >You don't seem to have any signs.[/color]

                                You have not examined the evidence of where this problem comes from,
                                which provides clear signs of what is really going on.
                                [color=blue]
                                >You've concocted an explanation
                                >that requires that some browsers not support an array index of 0,
                                >which seems much less likely than that somebody is playing with
                                >your forms.[/color]

                                That would be all well and good had this problem only been present in
                                the case of one or two customers, but this problem is repeated again
                                and again on order forms from customers all over this planet.

                                Since it serves no purpose or gain for these customers, then obviously
                                it is a compatibility bug. And sure enough had I asked these customers
                                their browser type and version, then a pattern should soon emerge.
                                [color=blue][color=green]
                                >>Not to mention that trying to submit a
                                >>such user modified false data to my hosting for on-line payment would
                                >>be rendered close to impossible due to the PHP code.[/color]
                                >
                                >That would be what they were trying to find out, by submitting
                                >forms with the weight changed. But, from what you've said
                                >before, and from what I see in your form, I'm not convinced
                                >that it would be difficult to slip false data past your code.[/color]

                                And certainly false data could be slipped through my code had that
                                been the customer's intention, but it is quite unlikely that such data
                                changes would go unnoticed.

                                Cardman


                                Comment

                                Working...