Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22388

Re: Javascript Help Needed

From Jim Rojas <jrojas@tech-man.com>
Newsgroups comp.lang.javascript
Subject Re: Javascript Help Needed
References <6h5uu.25363$gh2.7307@fx24.iad> <l9colr$do9$2@dont-email.me>
Message-ID <JLluu.70428$Rt7.49487@fx27.iad> (permalink)
Organization TeraNews.com
Date 2013-12-24 15:02 -0500

Show all headers | View raw


Denis McMahon wrote:
> On Mon, 23 Dec 2013 20:17:54 -0500, Jim Rojas wrote:
>
>> Hi. I have a javascript that needs to be modified to provide some basic
>> shipping calculations I need for my website.
>>
>> The script basically takes an array, and then displays it on a webpage.
>> At this point, there is only one table array. I need it to display 3 at
>> the same time.
>>
>> I understand how to manipulate the data, it is the javascript itself I
>> am having trouble with.
>>
>> I also want to be able to break up the code so the array tables are in
>> an include file for easy future modifications.
>
> Your problem description is still unclear. Perhaps you could step back
> and describe what you're actually trying to do, rather than trying to
> express things in terms of tables and arrays that are fairly meaningless.
>
> For example:
>
> "I have code to calculate shipping rates for usps. I also want to
> calculate shipping rates for fedex, ups and deutche post."
>
> Firstly, think about how you want to get input and present calculation
> results. Build the html structure that you want to input data from and
> put the results into.
>
> Secondly, get the base data needed for your calculations. I imagine this
> will be in the form of a table for each shipping method.
>
> Thirdly, write functions for each shipping method that takes the input
> data (us zip code or country of destination, package weight, package
> dimensions) and then calculates and displays the shipping for that
> shipping method using the base data.
>
> Perhaps I misunderstood what you're trying to do.
>
> I suggest that you put all your code in a single script section in the
> head of the document, that you don't use the "language" attribute for the
> script section, but instead use the type attribute: type="text/javascript"
>
> Ignore any elf-like apparition that tries to tell you this is wrong, and
> instead search the web to find out why this is right.
>
> Later on you may wish to separate your js code and data, and possibly
> have some server side system that automatically generates new data files
> when you update some set of master shipping cost tables.
>
> You have unescaped ampersands in your countries option list, and your
> innerhtml code includes html closing tags which it is usually a good idea
> to split up, eg instead of:
>
> blah.innerHTML += "</B>";
>
> use something like:
>
> blah.innerHTML += "<"+"/"+"B>";
>
> to avoid any sequence of '<' + '/' + letter occurring inside the script
> tags, as these may confuse the rendering engine.
>

I didn't write the script. I am not a programmer. I grabbed the code off 
a javascript resource page. What I am trying to do is this:

When you enter a package weight, I would like it to display 3 different 
shipping prices at the same time.

Rate 1 is FCPIS
Rate 2 is PMI
Rate 3 is PMEI

The script is originally only setup to display only one rate. The other 
rate arrays do not exist yet.

All I did was copy the same output code display, and changed the name 
for display purposes only.

Jim Rojas


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-23 20:17 -0500
  Re: Javascript Help Needed "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-24 09:17 +0100
    Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 10:01 -0500
      Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 10:02 -0500
      Re: Javascript Help Needed "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-24 18:11 +0100
        Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 12:24 -0500
          Re: Javascript Help Needed "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-24 19:03 +0100
          Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-24 19:18 +0000
    Re: Javascript Help Needed Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-25 23:06 +0000
  Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-24 19:52 +0000
    Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 15:02 -0500
      Re: Javascript Help Needed Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-24 22:07 +0100
      Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-25 02:16 +0000
        Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-24 21:48 -0500
      Re: Javascript Help Needed Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-25 23:05 +0000
    Re: Javascript Help Needed Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-24 22:09 +0100
      Re: Javascript Help Needed Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-25 01:51 +0000
      Re: Javascript Help Needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-26 07:38 +0100
        Re: Javascript Help Needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-26 10:42 +0100
          Re: Javascript Help Needed Jim Rojas <jrojas@tech-man.com> - 2013-12-26 13:14 -0500
        Re: Javascript Help Needed Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-27 22:49 +0100
          Re: Javascript Help Needed Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-27 23:25 +0100

csiph-web