cablesforless
12-20-2005, 08:49 AM
I can't get this code to work, it worked before I converted it to a string for document.write, so what do i do to get it to be a variable?
(notice I split it up into different variables so I could find the error, but I still can't find it)
<SCRIPT LANGUAGE='JavaScript'>
var custcheckouta
var custcheckoutb
var custcheckoutc
var custcheckoutd
var custcheckoute
var custcheckoutf
var custcheckoutg
var custcheckouth
var custcheckouti
var custcheckoutj
var custcheckoutk
var custcheckoutl
var custcheckoutm
var custcheckoutn
var custcheckouto
var custcheckoutp
var custcheckoutq
var custcheckoutr
if (document.location == document.location)
{
var custcheckouta = "<\/script> \n"
var custcheckoutb = "<SCRIPT LANGUAGE='JavaScript' for='ShippingOption' event='onclick'> \n if (document.frmCheckout4Step3.ShippingOption[0].checked == true) \n { \n document.Frmshipaccount.disabled=false \n document.Frmshipaccount.FedExAccountNumber.disabled=false \n document.Frmshipaccount.fedexfieldset.disabled=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].checked=true \n document.Frmshipaccount.FedExorUPSAAccount[1].checked=false \n } \n if (document.frmCheckout4Step3.ShippingOption[1].checked == true) \n { \n document.Frmshipaccount.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].checked=false \n document.Frmshipaccount.FedExorUPSAAccount[1].checked=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.FedExAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n } \n <\/script>\n"
var custcheckoutc = "<SCRIPT LANGUAGE='JavaScript' for='UPSAccountNumber' event='onkeyup'> \n if (document.Frmshipaccount.UPSAccountNumber.value.length == 6) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=false \n document.Frmshipaccount.shipme(0).focus() \n document.Frmshipaccount.FedExorUPSAAccount[0].disabled=true \n document.Frmshipaccount.subcustomship.disabled=false \n document.Frmshipaccount.txtbxcustomship.disabled=false \n document.Frmshipaccount.boxcustship.disabled=false \n document.Frmshipaccount.shipme[0].checked=true \n } \n if (document.Frmshipaccount.UPSAccountNumber.value.length < 6) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].disabled=false \n document.Frmshipaccount.subcustomship.disabled=true \n document.Frmshipaccount.txtbxcustomship.disabled=true \n document.Frmshipaccount.boxcustship.disabled=true \n } \n <\/script>\n"
var custcheckoutd = "<SCRIPT LANGUAGE='JavaScript' for='FedExAccountNumber' event='onkeyup'> \n if (document.Frmshipaccount.FedExAccountNumber.value.length == 9) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=false \n document.Frmshipaccount.shipme(0).focus() \n document.Frmshipaccount.FedExorUPSAAccount[1].disabled=true \n document.Frmshipaccount.subcustomship.disabled=false \n document.Frmshipaccount.txtbxcustomship.disabled=false \n document.Frmshipaccount.boxcustship.disabled=false \n document.Frmshipaccount.shipme[0].checked=true \n } \n if (document.Frmshipaccount.FedExAccountNumber.value.length < 9) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[1].disabled=false \n document.Frmshipaccount.subcustomship.disabled=true \n document.Frmshipaccount.txtbxcustomship.disabled=true \n document.Frmshipaccount.boxcustship.disabled=true \n } \n <\/script>\n"
var custcheckoute = "<SCRIPT LANGUAGE='JavaScript' for='Frmshipaccount' event='onclick'> \n if (document.Frmshipaccount.FedExorUPSAAccount[0].checked == true) \n { \n document.Frmshipaccount.FedExAccountNumber.disabled=false \n document.Frmshipaccount.fedexfieldset.disabled=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n } \n if (document.Frmshipaccount.FedExorUPSAAccount[1].checked == true) \n { \n document.Frmshipaccount.FedExAccountNumber.disabled=true \n document.Frmshipaccount.fedexfieldset.disabled=true \n document.Frmshipaccount.UPSAccountNumber.disabled=false \n document.Frmshipaccount.upsfieldset.disabled=false \n } \n <\/script>\n"
var custcheckoutf = "<SCRIPT LANGUAGE='JavaScript'> \n if (document.frmCheckout4Step3.ShippingOption[0].checked == true) \n { \n document.Frmshipaccount.disabled=false \n document.Frmshipaccount.FedExAccountNumber.disabled=false \n document.Frmshipaccount.fedexfieldset.disabled=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].checked = true \n } \n if (document.frmCheckout4Step3.ShippingOption[1].checked == true) \n { \n document.Frmshipaccount.disabled=true \n document.Frmshipaccount.FedExAccountNumber.disabled=true \n document.Frmshipaccount.fedexfieldset.disabled=true \n document.Frmshipaccount.UPSAccountNumber.disabled=false \n document.Frmshipaccount.upsfieldset.disabled=false \n document.Frmshipaccount.FedExorUPSAAccount[0].checked=false}<\/script>\n"
var custcheckoutg = "<SCRIPT LANGUAGE='JavaScript'>document.frmCheckout4Step3.txtSpecialInstructions.disabled = true<\/SCRIPT>\n"
var custcheckouth = "<SCRIPT LANGUAGE='JavaScript' for='subcustomship' event='onclick'>\n"
var custcheckouti = "if (document.Frmshipaccount.FedExAccountNumber.disabled==false) \n {var shippingaccnum = document.Frmshipaccount.FedExAccountNumber.value}\n"
var custcheckoutj = "if (document.Frmshipaccount.UPSAccountNumber.disabled==false) \n {var shippingaccnum = document.Frmshipaccount.UPSAccountNumber.value}\n"
var custcheckoutk = "var i = 0 \n while (i<=4) \n {if (document.Frmshipaccount.shipme[i].checked==true) \n {var shippingpref = document.Frmshipaccount.shipme[i].value \n i=5}i = i + 1}\n"
var custcheckoutl = "if (document.frmCheckout4Step3.txtSpecialInstructions.value > '') \n {var shippingordnot = document.frmCheckout4Step3.txtSpecialInstructions.value}\n"
var custcheckoutm = "var shippingpopupmenu = ('Account Number: ' + shippingaccnum + '\n' + 'Shipping Preference: ' + shippingpref + '\n' + 'Order Notes: ' + shippingordnot)"
var custcheckoutn = "var popmeup = confirm('Is this shipping information correct?' + '\n' + shippingpopupmenu)\n"
var custcheckouto = "if (popmeup == true) \n {document.frmCheckout4Step3.txtSpecialInstructions.value = shippingpopupmenu \n document.Frmshipaccount.disabled=true}\n"
var custcheckoutp = "<\/SCRIPT>\n"
var custcheckoutq = "<SCRIPT LANGUAGE='JavaScript' for='submit' event='onclick'>document.frmCheckout4Step3.txtSpecialInstructions.disabled = false<\/SCRIPT>\n"
var custcheckoutr = "<script>\n"
document.write(custcheckouta + custcheckoutb + custcheckoutc + custcheckoutd + custcheckoute + custcheckoutf + custcheckoutg + custcheckouth + custcheckouti + custcheckoutj + custcheckoutk + custcheckoutl + custcheckoutm + custcheckoutn + custcheckouto + custcheckoutp + custcheckoutq + custcheckoutr)
}
//https://www.cablesforless.com/index.asp?PageAction=CARTCHECKOUT&Step=3&Carrier=CUSTOM
</SCRIPT>
(notice I split it up into different variables so I could find the error, but I still can't find it)
<SCRIPT LANGUAGE='JavaScript'>
var custcheckouta
var custcheckoutb
var custcheckoutc
var custcheckoutd
var custcheckoute
var custcheckoutf
var custcheckoutg
var custcheckouth
var custcheckouti
var custcheckoutj
var custcheckoutk
var custcheckoutl
var custcheckoutm
var custcheckoutn
var custcheckouto
var custcheckoutp
var custcheckoutq
var custcheckoutr
if (document.location == document.location)
{
var custcheckouta = "<\/script> \n"
var custcheckoutb = "<SCRIPT LANGUAGE='JavaScript' for='ShippingOption' event='onclick'> \n if (document.frmCheckout4Step3.ShippingOption[0].checked == true) \n { \n document.Frmshipaccount.disabled=false \n document.Frmshipaccount.FedExAccountNumber.disabled=false \n document.Frmshipaccount.fedexfieldset.disabled=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].checked=true \n document.Frmshipaccount.FedExorUPSAAccount[1].checked=false \n } \n if (document.frmCheckout4Step3.ShippingOption[1].checked == true) \n { \n document.Frmshipaccount.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].checked=false \n document.Frmshipaccount.FedExorUPSAAccount[1].checked=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.FedExAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n } \n <\/script>\n"
var custcheckoutc = "<SCRIPT LANGUAGE='JavaScript' for='UPSAccountNumber' event='onkeyup'> \n if (document.Frmshipaccount.UPSAccountNumber.value.length == 6) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=false \n document.Frmshipaccount.shipme(0).focus() \n document.Frmshipaccount.FedExorUPSAAccount[0].disabled=true \n document.Frmshipaccount.subcustomship.disabled=false \n document.Frmshipaccount.txtbxcustomship.disabled=false \n document.Frmshipaccount.boxcustship.disabled=false \n document.Frmshipaccount.shipme[0].checked=true \n } \n if (document.Frmshipaccount.UPSAccountNumber.value.length < 6) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].disabled=false \n document.Frmshipaccount.subcustomship.disabled=true \n document.Frmshipaccount.txtbxcustomship.disabled=true \n document.Frmshipaccount.boxcustship.disabled=true \n } \n <\/script>\n"
var custcheckoutd = "<SCRIPT LANGUAGE='JavaScript' for='FedExAccountNumber' event='onkeyup'> \n if (document.Frmshipaccount.FedExAccountNumber.value.length == 9) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=false \n document.Frmshipaccount.shipme(0).focus() \n document.Frmshipaccount.FedExorUPSAAccount[1].disabled=true \n document.Frmshipaccount.subcustomship.disabled=false \n document.Frmshipaccount.txtbxcustomship.disabled=false \n document.Frmshipaccount.boxcustship.disabled=false \n document.Frmshipaccount.shipme[0].checked=true \n } \n if (document.Frmshipaccount.FedExAccountNumber.value.length < 9) \n { \n document.Frmshipaccount.shipmethfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[1].disabled=false \n document.Frmshipaccount.subcustomship.disabled=true \n document.Frmshipaccount.txtbxcustomship.disabled=true \n document.Frmshipaccount.boxcustship.disabled=true \n } \n <\/script>\n"
var custcheckoute = "<SCRIPT LANGUAGE='JavaScript' for='Frmshipaccount' event='onclick'> \n if (document.Frmshipaccount.FedExorUPSAAccount[0].checked == true) \n { \n document.Frmshipaccount.FedExAccountNumber.disabled=false \n document.Frmshipaccount.fedexfieldset.disabled=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n } \n if (document.Frmshipaccount.FedExorUPSAAccount[1].checked == true) \n { \n document.Frmshipaccount.FedExAccountNumber.disabled=true \n document.Frmshipaccount.fedexfieldset.disabled=true \n document.Frmshipaccount.UPSAccountNumber.disabled=false \n document.Frmshipaccount.upsfieldset.disabled=false \n } \n <\/script>\n"
var custcheckoutf = "<SCRIPT LANGUAGE='JavaScript'> \n if (document.frmCheckout4Step3.ShippingOption[0].checked == true) \n { \n document.Frmshipaccount.disabled=false \n document.Frmshipaccount.FedExAccountNumber.disabled=false \n document.Frmshipaccount.fedexfieldset.disabled=false \n document.Frmshipaccount.UPSAccountNumber.disabled=true \n document.Frmshipaccount.upsfieldset.disabled=true \n document.Frmshipaccount.FedExorUPSAAccount[0].checked = true \n } \n if (document.frmCheckout4Step3.ShippingOption[1].checked == true) \n { \n document.Frmshipaccount.disabled=true \n document.Frmshipaccount.FedExAccountNumber.disabled=true \n document.Frmshipaccount.fedexfieldset.disabled=true \n document.Frmshipaccount.UPSAccountNumber.disabled=false \n document.Frmshipaccount.upsfieldset.disabled=false \n document.Frmshipaccount.FedExorUPSAAccount[0].checked=false}<\/script>\n"
var custcheckoutg = "<SCRIPT LANGUAGE='JavaScript'>document.frmCheckout4Step3.txtSpecialInstructions.disabled = true<\/SCRIPT>\n"
var custcheckouth = "<SCRIPT LANGUAGE='JavaScript' for='subcustomship' event='onclick'>\n"
var custcheckouti = "if (document.Frmshipaccount.FedExAccountNumber.disabled==false) \n {var shippingaccnum = document.Frmshipaccount.FedExAccountNumber.value}\n"
var custcheckoutj = "if (document.Frmshipaccount.UPSAccountNumber.disabled==false) \n {var shippingaccnum = document.Frmshipaccount.UPSAccountNumber.value}\n"
var custcheckoutk = "var i = 0 \n while (i<=4) \n {if (document.Frmshipaccount.shipme[i].checked==true) \n {var shippingpref = document.Frmshipaccount.shipme[i].value \n i=5}i = i + 1}\n"
var custcheckoutl = "if (document.frmCheckout4Step3.txtSpecialInstructions.value > '') \n {var shippingordnot = document.frmCheckout4Step3.txtSpecialInstructions.value}\n"
var custcheckoutm = "var shippingpopupmenu = ('Account Number: ' + shippingaccnum + '\n' + 'Shipping Preference: ' + shippingpref + '\n' + 'Order Notes: ' + shippingordnot)"
var custcheckoutn = "var popmeup = confirm('Is this shipping information correct?' + '\n' + shippingpopupmenu)\n"
var custcheckouto = "if (popmeup == true) \n {document.frmCheckout4Step3.txtSpecialInstructions.value = shippingpopupmenu \n document.Frmshipaccount.disabled=true}\n"
var custcheckoutp = "<\/SCRIPT>\n"
var custcheckoutq = "<SCRIPT LANGUAGE='JavaScript' for='submit' event='onclick'>document.frmCheckout4Step3.txtSpecialInstructions.disabled = false<\/SCRIPT>\n"
var custcheckoutr = "<script>\n"
document.write(custcheckouta + custcheckoutb + custcheckoutc + custcheckoutd + custcheckoute + custcheckoutf + custcheckoutg + custcheckouth + custcheckouti + custcheckoutj + custcheckoutk + custcheckoutl + custcheckoutm + custcheckoutn + custcheckouto + custcheckoutp + custcheckoutq + custcheckoutr)
}
//https://www.cablesforless.com/index.asp?PageAction=CARTCHECKOUT&Step=3&Carrier=CUSTOM
</SCRIPT>