Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: cross browser compatible


Message #1 by "ramy m" <ramymoneiry@y...> on Tue, 4 Mar 2003 20:39:55
As far as I can see (after a quick glance), this code should work back
to
IE 4 and in IE 6 as well.

You mentioned an error before; in what browser and what was the error
message?


/Robert


-----Original Message-----
From: ramy m [mailto:ramymoneiry@y...]
Sent: den 4 mars 2003 21:40
To: JavaScript HowTo
Subject: [javascript_howto] cross browser compatible


hi all

   is the following code cross browser compatible ?? . I tested it on IE

5.5 but does this code will works fine with the other IE versions .

 "shippingMethods" is a radio button.
 "orderPrioritys" is a check box.
 "orderDummyPriority" is a check box.



function CheckValues()
{
	if(document.shippingOptions.orderDummyPriority.checked)
	{
		document.shippingOptions.orderPrioritys.checked =3D false;

		for (var i=3D0;
i<document.shippingOptions.shippingMethods.length; i++)
		  document.shippingOptions.shippingMethods[i].checked =3D
false;


	}

}


function CheckMainValues()
{
	if(document.shippingOptions.orderPrioritys.checked)
	{
		document.shippingOptions.orderPriority.value =3D "1";
		document.shippingOptions.orderDummyPriority.checked =3D
false;

	}
	else
	{
		document.shippingOptions.orderPriority.value =3D "2";
	}


}

function CheckMainValuesWhenNonRush()
{
	document.shippingOptions.orderPriority.value =3D "2";
}


function Validate()
{
//alert
(document.shippingOptions.orderPrioritys.checked+"
"+document.shippingOpti ons.shippingMethod[0].checked+"
"+document.shippingOptions.shippingMethod
[1].checked);
	var errors =3D "";
	var msg=3D"";
	var check=3D0;

	if(document.shippingOptions.shippingMethods[0].checked ||
document.shippingOptions.shippingMethods[1].checked )
	{
			if(!
document.shippingOptions.orderPrioritys.checked)
			{
				check=3D1;
				errors +=3D "Please check the Rush Order
Box
to ship the order \n at Next Day Air or Second Day Air";

			}
	}

	if(document.shippingOptions.orderPrioritys.checked)
	{
		document.shippingOptions.orderDummyPriority.checked =3D
false;
		if(!document.shippingOptions.shippingMethods[0].checked
&& !document.shippingOptions.shippingMethods[1].checked)
		{
			check=3D1;
			errors +=3D " Please check Next Day Air / Second
Day
Air as Rush Order has been Selected";
		}

	}

	if(document.shippingOptions.shippingMethods[0].checked)
=09
=09
document.shippingOptions.shippingMethod.value=3Ddocument.shippingOpti
ons.shippingMethods[0].value;
	else if (document.shippingOptions.shippingMethods[1].checked)
=09
=09
document.shippingOptions.shippingMethod.value=3Ddocument.shippingOpti
ons.shippingMethods[1].value;
	else{

		if (!document.shippingOptions.orderDummyPriority.checked

&& !document.shippingOptions.orderPriority.checked) {
			
document.shippingOptions.orderDummyPriority.checked =3D true ;
			 document.shippingOptions.orderPriority.value
=3D "2";
	    }
	 	document.shippingOptions.shippingMethod.value=3D"<%=3D
shipmentID %>";

	}






		msg 
=3D "______________________________________________________\n\n";
		msg +=3D "   The form was not submitted because of the
following error(s).\n";
		msg +=3D "   Please correct these error(s) and
re-submit.\n";
		msg
+=3D "______________________________________________________\n\n";

		msg +=3D errors;

		if(check=3D=3D1)
		{
			alert(msg);
			document.shippingOptions.orderPrioritys.focus();
			return false;

		}
		return true;
}

</script>



thanks

  Return to Index