Click to See Complete Forum and Search --> : Populate HTML field whose name begins with a digit


dan_wakeman
07-31-2003, 11:08 AM
Hi,

I've tinkered with HTML for several years, but only enough to modify existing pages. JavaScript is brand new to me.

I need to perform a simple calculation, A/B (an estimated weight), presumably in JavaScript, and put the result in an HTML field. The problem is that the field name begins with a digit, 23_weight. This field name cannot change, because it and several other fields will be submitted to a CGI at UPS to calculate freight.

I made a model javascript work with a field without the leading digits. How can this field - as named - be populated with the answer?

Thanks.
Dan

pyro
07-31-2003, 11:43 AM
Post what you have so far...

dan_wakeman
08-01-2003, 09:03 AM
I picked up a tip elsewhere that solved my problem. Thanks Pyro. Here's the fix.

document.getElementById("23_weight").value=Math.round(parseFloat(dollars)/parseFloat(divisor))