Cand somebody look at my script (bellow) and tell me what I need to change/add so it works in both IE and Firefox. Right now it works without a problem in IE but in Firefox the variable postStr remains undefined. You will see in my code I do an alert of postStr where it tells me undefined. Any assistance would be appreciated.
[CODE]
function QuotePage()
{
if (document.getElementById(“frmSignIn”))//Sign In Form
{
var postStr=”txtEmail=” + encodeURI(document.getElementById(“txtEmail”).value) + “&txtPassword=” + encodeURI(document.getElementById(“txtPassword”).value);
var url = “quote.php”;
}
else //Quote Page
{
if(document.getElementById(“txtContact”)) //Existing Customer
{
var postStr=”txtRequestDate=” + encodeURI(document.getElementById(“txtRequestDate”).value) + “txtCustomerID=” + encodeURI(document.getElementById(“txtCustomerID”).value) + “txtContact=” + encodeURI(document.getElementById(“txtContact”).value) + “txtBusinessName=” + encodeURI(document.getElementById(“txtBusinessName”).value) + “txtBillingAddress=” + encodeURI(document.getElementById(“txtBillingAddress”).value) + “txtShippingAddress=” + encodeURI(document.getElementById(“txtShippingAddress”).value) + “txtQuoteRequest=” + encodeURI(document.getElementById(“txtQuoteRequest”).value) + “txtEmail=” + encodeURI(document.getElementById(“txtEmail”).value) + “txtPassword=” + encodeURI(document.getElementById(“txtPassword”).value);
}
else //New Customer
{
}
var url = “quote_complete.php”;
}
if (window.XMLHttpRequest)
{
xhr = new XMLHttpRequest();
}
else
{
if (window.ActiveXObject)
{
try
{
xhr = new ActiveXObject(“Microsoft.XMLHTTP”);
}
catch (e){}
}
}
if (xhr)
{
alert(postStr);
xhr.onreadystatechange = showContents;
xhr.open(“POST”, url, true);
xhr.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”);
xhr.setRequestHeader(“Content-length”, postStr.length);
xhr.setRequestHeader(“Connection”, “close”);
xhr.send(postStr);
}
else
{
alert(“Sorry, but I couldn’t create an XMLHttpRequest”);
}
}