文档没有将InnerHTML写入DIV

时间:2013-10-11 22:34:37

标签: javascript dom innerhtml

更新我已更正错误。除了一些拼写错误之外,还有一些语法错误并不明显。我想出了如何使用Firefox的Firebug来发现其余部分。

感谢所有花时间阅读我的新帖的人。

我的代码需要一些帮助。我有另一个版本,问题较少的问题很好。我似乎无法找到这个被打破的地方。在输入/更改表单字段后,我遇到的问题是在DIV中没有显示。重置按钮正常工作。此外,对脚本软件的任何建议表示赞赏。

谢谢,

Strutte2

        <script type="text/javascript">
            function processForm() {
                var customer_Name = document.configInfo.customername.value;
                var order_Number = document.configInfo.ordernumber.value;
                var base_Model = document.configInfo.basemodel.value;
                var install_Country = document.configInfo.basemodel.value;
                var install_State = document.configInfo.installstate.value;
                var pump_Type = document.configInfo.pumptype.value;
                var Style = document.configInfo.style.value;
                var Blender = document.configInfo.blender.value;
                var specify_Side = document.configInfo.specifyside.value;
                var grades_Products = document.configInfo.gradesproducts.value;
                var hoses_Nozzles = document.configInfo.hosesnozzles.value;
                var payment_Interface = document.configInfo.paymentinterface.value;
                var meter_Type = document.configInfo.metertype.value;
                var fuel_Combinations = document.configInfo.fuelcombinations.value;
                var fuel_Inlet1 = document.configInfo.fuelinlet1.value;
                var fuel_Inlet2 = document.configInfo.fuelinlet2.value;
                var fuel_Inlet3 = document.configInfo.fuelinlet3.value;
                var vapor_Recovery = document.configInfo.vaporrecovery.value;
                var remote_Filter = document.configInfo.remotefilter.value;
                var hydrosorb_Strainer = document.configInfo.hydrosorbstrainer.value;
                var junction_Box = document.configInfo.junctionbox.value;
                var hose_Handling = document.configInfo.hoseretraction.value;
                var nozzle_Activation = document.configInfo.nozzleactivation.value;
                var Hoses = document.configInfo.hoses.value;
                var Nozzles = document.configInfo.nozzles.value;
                var payment_Platform = document.configInfo.paymentplatform.value;
                var Display = document.configInfo.display.value;
                var soft_Keys = document.configInfo.softkeys.value;
                var ethernet_Options = document.configInfo.ethernetoptions.value;
                var payment_Keypad = document.configInfo.ethernetoptions.value;
                var card_Reader = document.configInfo.cardreader.value;
                var sales_Volume = document.configInfo.salesvolume.value;
                var unit_Price = document.configInfo.pricedisplay.value;
                var preset_Keypad = document.configInfo.presetkeypad.value;
                var stop_Button = document.configInfo.stopbutton.value;
                var Totalizers = document.configInfo.totalizers.value;
                var Intercom = document.configInfo.intercom.value;
                var lock_Options = document.configInfo.lockoptions.value;
                var security_Switches = document.configInfo.securityswitches.value;
                var dallas_Reader = document.configInfo.dallasreader.value; 
                var Valance = document.configInfo.valance.value;
                var custom_Panel = document.configInfo.custompanel.value;   
`               var Packaging = document.configInfo.packaging.value;
                var graphics_Spec = document.configInfo.graphicsspec.value;
                var product_Ids = document.configInfo.productids.value;
                var Language = document.configInfo.language.value;
                var auto_Discount = document.configInfo.autodiscount.value;
                var keypad_Assembly = document.configInfo.keypadassembly.value;
                var model_String = document.configInfo.modelstring.value;
                var CSR = document.configInfo.csr.value;
                var phone_Ext = document.configInfo.phoneext.value; 


                var holdInfo =  '<div> Customer Name: ' + customer_Name + '</div>' +
                            '<div> Order Number:' + order_Number + '</div>' +
                        '<div> Base Model: ' + base_Model + '</div>' + 
                        '<div> Installation Country ' + install_Country + '</div>' + 
                        '<div> Installation State ' + install_State + '</div>' + 
                        '<div> Pump Type:' + pump_Type + '</div>' + 
                        '<div> Style: ' + Style+ '</div>' +
                        '<div> Blender: ' + Blender+ '</div>' +
                        '<div> Specify Side: ' + specify_Side+ '</div>' +
                        '<div> No. Grades/Products: ' + grades_Products+ '</div>' +
                        '<div> No. Hoses/Nozzles: ' + hoses_Nozzles+ '</div>' +
                        '<div> Payment Interface: ' + payment_Interface+ '</div>' +
                        '<div> Meter Type: ' + meter_Type+ '</div>' +
                        '<div> Fuel Combinations: ' + fuel_Combinations+ '</div>' +
                        '<div> Fuel Inlet 1: ' + fuel_Inlet1+ '</div>' +
                        '<div> Fuel Inlet 2: ' + fuel_Inlet2+ '</div>' +
                        '<div> Fuel Inlet 3: ' + fuel_Inlet3+ '</div>' +
                        '<div> Vapor Recovery: ' + vapor_Recovery+ '</div>' +
                        '<div> Remote Filter: ' + remote_Filter+ '</div>' +
                        '<div> Hydrosorb Strainer: ' + hydrosorb_Strainer+ '</div>' +
                        '<div> Junction Box: ' + junction_Box+ '</div>' +
                        '<div> Hose Handling: ' + hose_Handling+ '</div>' +
                        '<div> Nozzle Activation: ' + nozzle_Activation+ '</div>' +
                        '<div> Hoses: ' + Hoses+ '</div>' +
                        '<div> Nozzles: ' + Nozzles+ '</div>' +
                        '<div> Payment Platform: ' + payment_Platform+ '</div>' +
                        '<div> Display: ' + Display+ '</div>' +
                        '<div> Soft Keys: ' + soft_Keys+ '</div>' +
                        '<div> Ethernet Options: ' + ethernet_Options+ '</div>' +
                        '<div> Payment Keypad: ' + payment_Keypad+ '</div>' +
                        '<div> Card Reader: ' + card_Reader+ '</div>' +
                        '<div> Sales Volume: ' + sales_Volume+ '</div>' +
                        '<div> Unit Price Display: ' + unit_Price+ '</div>' +
                        '<div> Preset Keypad: ' + preset_Keypad+ '</div>' +
                        '<div> Stop Button:  ' + stop_Button+ '</div>' +
                        '<div> Totalizers: ' + Totalizers+ '</div>' +
                        '<div> Intercom:  ' + Intercom+ '</div>' +
                        '<div> Lock Options: ' + lock_Options+ '</div>' +
                        '<div> Security Switches: ' + security_Switches+ '</div>' +
                        '<div> IDS (Dallas) Reader: ' + dallas_Reader+ '</div>' +
                        '<div> Valance: ' + Valance+ '</div>' +
                        '<div> Extra Custom Panel: ' + custom_Panel+ '</div>' +
                        '<div> Packaging: ' + Packaging+ '</div>' +
                        '<div> Graphics Spec & #: ' + graphics_Spec+ '</div>' +
                        '<div> Product IDs: ' + product_Ids+ '</div>' +
                        '<div> Language: ' + Language+ '</div>' +
                        '<div> Automatic Discount: ' + auto_Discount+ '</div>' +
                        '<div> Keypad Assembly: ' + keypad_Assembly+ '</div>' +
                        '<div> Model String: ' + model_String + '</div>' +
                        '<div> CSR: ' + CSR + '</div>' +
                        '<div> Phone Ext: ' + phone_Ext + '</div>';

                    document.getElementById("copyfield").innerHTML = holdInfo;  

                        }

            function clearForm() {
                var blank = "";
                document.getElementById('copyfield').innerHTML = blank;
            }


        </script>

JSLint在定义错误方面没有多大帮助。

2 个答案:

答案 0 :(得分:1)

此行看起来像拼写错误(configINfo的拼写错误):

var install_State = document.configINfo.installstate.value;

浏览器中的错误控制台应显示发生脚本错误的确切行。可能还有其他错误。

答案 1 :(得分:0)

有多个拼写错误

CHANGE:

var install_State = document.configINfo.installstate.value;

TO:

var install_State = document.configInfo.installstate.value;

改变:

var hose_Handling = document.configInfo.hosehandling.value;

TO:

var hose_Handling = document.configInfo.hoseretraction.value;

CHANGE:

var unit_Price = document.configInfo.unitprice.value;

TO:

var unit_Price = document.configInfo.pricedisplay.value;