Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form stops working

Status
Not open for further replies.

jcalar

Technical User
Dec 29, 2000
7
US
I am using an online form with calculation done in Javascript that someone else started. I have used it on two different sites for a shopping cart type effect, but with the second site I am only able to add a certain number of items and then the form will not submit in IE for PC. Up until a certain number I haven't yet determined, it works fine, but I hit a point where you click Submit and it does nothing. Works just fine on a Mac though! If it helps, a working version of this script is on
Here is a condensed version; note I first have a script for a popup window, but that does not seem to interfere.

<script language=Javascript>
<!-- HIDE FROM OLD BROWSERS

browser = navigator.appName; // detect browser
ver = parseInt(navigator.appVersion); // detect version#

function openphoto(html) {

open_window =
window.open(html,&quot;photo&quot;,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0,width=400,height=400');
if ((browser==&quot;Microsoft Internet Explorer&quot; && ver<=3) || (ver<3)) {
} else {
open_window.focus();
}
}


var NumItems;

function roundOff(value) {
value = &quot;&quot; + value //convert value to string
precision = 2;

var whole = &quot;&quot; + Math.round(value * Math.pow(10, precision));

var decPoint = whole.length - precision;

if(decPoint != 0) {
result = whole.substring(0, decPoint);
result += &quot;.&quot;;
result += whole.substring(decPoint, whole.length);
} else {
result = whole;
}

if (result.length < 7) {
for (x=result.length;x<7;x++) {
result = &quot; &quot; + result
}
} return result;
}


function getnum(s) {
var s1;
s1 = parseInt(s);
//alert(&quot;[&quot; + s.substring(0,1) + &quot;]&quot;)
if (s.substring(0,1) == &quot; &quot;) return 0;
if (s1 < 1 || s1 > 99) return 0;
if (s == &quot;&quot;) return 0;
NumItems = NumItems + parseInt(s1);
return (s1);
}


function isaPosNum(s) {
return (parseInt(s) > -1)
}

function addAll(orderform,check) {
var Mdenim
var Ldenim
var Subtotal
var Tax
var Total

<!--INDIVIDUAL ITEMS-->

NumItems = 0;

Mdenim = ((getnum(orderform.Denim_MensLS_Med.value) + getnum(orderform.Denim_MensSS_3X.value)) * 50);

Ldenim = ((getnum(orderform.Denim_WomensLS_Sm.value) + getnum(orderform.Denim_WomensSS_XL.value)) * 45);



<!--SUBTOTAL-->

Subtotal = (Mdenim + Ldenim);

orderform.Subtotal.value = roundOff(Subtotal);

<!--TAX-->

Tax = 0

if (orderform.STATE.selectedIndex == 9) {
Tax = Subtotal * 0.07;
orderform.TAX.value = roundOff(Tax);
}


Total = Subtotal + Tax
orderform.AMOUNT.value = roundOff(Total);


if (check == true ) {
if (NumItems == 0 ) {
alert(&quot;Please choose some items to purchase&quot;)
return false;
}
if (orderform.NAME.value == &quot;&quot; ) {
alert(&quot;Please Enter your NAME&quot;)
return false;
}
if (orderform.ADDRESS.value == &quot;&quot; ) {
alert(&quot;Please enter your ADDRESS&quot;)
return false;
}
if (orderform.CITY.value == &quot;&quot; ) {
alert(&quot;Please enter your CITY&quot;)
return false;
}
if (orderform.STATE.selectedIndex == 0) {
alert(&quot;Please enter your STATE &quot;)
return false;
}
if (orderform.ZIP.value == &quot;&quot; ) {
alert(&quot;Please enter your ZIP&quot;)
return false;
}
if (orderform.EMAIL.value == &quot;&quot; ) {
alert(&quot;Please enter your EMAIL&quot;)
return false;
}
if (orderform.PHONE.value == &quot;&quot; ) {
alert(&quot;Please enter your PHONE&quot;)
return false;
}
}
return true;
}


// Stop hiding from old browsers -->
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top