Google Answers Logo
View Question
 
Q: Javascript not working in Netscape 7.1 ( No Answer,   0 Comments )
Question  
Subject: Javascript not working in Netscape 7.1
Category: Computers > Programming
Asked by: bathsheba-ga
List Price: $20.00
Posted: 18 Oct 2005 00:24 PDT
Expires: 18 Oct 2005 12:21 PDT
Question ID: 581569
I have a shopping cart that uses Javascript, and it works in MSIE,
Firefox, Netscape 8, but not Netscape 7.1.  I urgently need to debug
the Netscape 7 behavior but don't have enough Javascript chops to do
it.  I usually write Perl.

I'm hoping this is a quick question involving some known wrinkle in this 
browser's JS handling.  I don't need the code rewritten, just the clue
as to why these scripts don't work. 

If it's not a quick question, the next best type of answer would be a
hint about how to debug Javascript in Netscape.  Currently the scripts
fail silently and I don't know how to make them produce a useful error
message.

Now for the code.  There are two functions.  The first is called when
the form submits, and it fools with the fields before submitting to
the credit-card processor.  It looks like this:

function preprocess () {
//strip end spaces from billing name
  var str = mainform.GWNameOnCard.value.replace(/^[\s]+/,"");
  str = str.replace(/[\s]+$/,"")
  mainform.GWNameOnCard.value = str

//split billing name at last space
  var i = str.lastIndexOf(' ');

  if (i == -1)
  {
   mainform.GWBillingFirstName.value = " ";
   mainform.GWBillingLastName.value = str;
  } else
  {
   mainform.GWBillingFirstName.value = str.substring(0,i);
   mainform.GWBillingLastName.value = str.substring(i + 1);
  }

//concatenate billing address fields
  mainform.GWBillingAddress.value = mainform.BillAddress.value;
  if (mainform.BillAddress2.value.length > 0)
  {
   mainform.GWBillingAddress.value = mainform.BillAddress.value + ", "
+ mainform.BillAddress2.value;
  }

//use NA for blank zip
  mainform.GWBillingZip.value = (mainform.GWBillingZip.value == "" ?
"NA" : mainform.GWBillingZip.value);
}

The call looks like this: 
<form name="mainform" method="POST" action="<<credit card URL>>"
onsubmit="preprocess();">


The other function copies shipping address fields into billing address fields:
function copybill () {
  mainform.GWNameOnCard.value = mainform.ShipName.value;
  mainform.BillAddress.value = mainform.ShipAddress.value;
  mainform.BillAddress2.value = mainform.ShipAddress2.value;

  mainform.GWBillingCity.value = mainform.ShipCity.value;
  mainform.GWBillingZip.value = mainform.ShipZip.value;
  mainform.GWBillingCountry.value = mainform.ShipCountry.value;

//copy state field
  mainform.GWBillingState.selectedIndex = mainform.ShipState.selectedIndex +
    (mainform.ShipState.selectedIndex < 4 ? 1 : 2);
  mainform.GWBillingCountry.selectedIndex = 0;
}

and the call is like this:
<input type="button" value="Same as Shipping Address" onClick="copybill();">


Yes, Javascript is turned on in my Netscape 7.1.  Yes, the form name and
form field names match.  Everything works in MSIE and Firefox, these
scripts are handling live transactions and everyone but Netscape
users is doing fine.  I've tried cutting copybill() back to a single
line with nothing in it but one form field assignment and it still
doesn't work.

Hope you can help -- thanks much for reading!
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy