文档未将内部 HTML 写入 DIV

Document Not Writing InnerHTML to DIV

本文关键字:写入 DIV HTML 内部 文档      更新时间:2023-09-26

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

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

需要一些关于我的代码的帮助。我有另一个版本,问题较少,工作正常。我似乎找不到这个坏在哪里。我遇到的问题是输入/更改表单字段后 DIV 中没有任何内容显示。重置按钮工作正常。此外,感谢对脚本软件的任何建议。

谢谢

支柱2

        <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 在定义错误方面没有多大帮助。

这一行看起来像一个错字(configINfo拼写错误):

var install_State = document.configINfo.installstate.value;

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

拼写错误不止一个

改变:

var install_State = document.configINfo.installstate.value;

自:

var install_State = document.configInfo.installstate.value;

改变:

var hose_Handling = document.configInfo.hosehandling.value;

自:

var hose_Handling = document.configInfo.hoseretraction.value;

改变:

var unit_Price = document.configInfo.unitprice.value;

自:

var unit_Price = document.configInfo.pricedisplay.value;