This javascript works great in IE. But won't run in netscape or FF. In the page it is called by onBlur and onClick in two different places. I don't know much about the different browsers, but is there something that jumps out in the code that isn't compatable?
function screen() {
var subject=document.forms.orderform_16180;
var x = subject.amount.value;
var y = "Incomplete data";
var total = document.forms.formjunk.product_options_amountzz.value;
var my_select = document.getElementById("product_options_colorzz");
var my_selectz = document.getElementById("product_options_Sizezz");
var opts = my_select.options;
var optsz = my_selectz.options;
var choice = my_select.selectedIndex;
var choicez = my_selectz.selectedIndex;
var value = my_select.options[my_select.selectedIndex].value;
var valuez = my_selectz.options[my_selectz.selectedIndex].value;
var htextra = document.forms.myform.total.value;
var ssextraf = document.forms.myform.sscolorfront.value;
var ssextrab = document.forms.myform.sscolorback.value;
var ssextrar = document.forms.myform.sscolorright.value;
var ssextral = document.forms.myform.sscolorleft.value;
var ssextra = (ssextraf) - (-ssextrab) - (-ssextrar) - (-ssextral);
//var white = document.forms.formjunk.product_options_colorzz.0;
if (1<=x && x<=20) y=(0.0524*x*x)-(2.1391*x)+(32.04575);
if (20<x && x<=50) y=39.779 * Math.pow(x, -0.4532);
if (50<x && x<=288) y=(10.4835 * Math.pow(x, -0.121635))+.2;
if (288<x && x<=4200) y=(10.4835 * Math.pow(x, -0.121635))+.2;
if (4200<x) y=4;
What Fang said. Unless your form is named "forms" that code is incorrect. You either reference it by name, and use dot notation as you have it there, or you use forms[0], if it's the 1st or only form, or you do what Fang posted.
Bookmarks