Jim from Oakland Posted January 6, 2007 Share Posted January 6, 2007 phreaksI am a total hacker in javascript! In IE I get the value of a hidden input as shown. In Netscape the last statement chokes. What syntax might I try?pItemIndex = 1;sValueFieldName = 'Item' + pItemIndex + 'Price';oValueField = document.getElementById(sValueFieldName);dValue = oValueField.value; Quote Link to comment Share on other sites More sharing options...
fenway Posted January 6, 2007 Share Posted January 6, 2007 Post the page code snippet so we can see for ourselves... I"m confused. Quote Link to comment Share on other sites More sharing options...
Jim from Oakland Posted January 7, 2007 Author Share Posted January 7, 2007 fenwayThanks for offering to assist. I'm not sure how to be more clear. That is the exact code. It is in a longer js function that does the same thing several times. The entire funciton works fine in IE but in Navagator it does not. I am merely looking to get the value from a hidden input field. In my example the hidden field name is Item1Price<input type="hidden" name="Item1Price" value=12.99>How do I retrieve the value 12.99?Note: pItemIndex is an integer. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 7, 2007 Share Posted January 7, 2007 I don't see an ID attribute on that INPUT -- neither does Navigator. If IE does, well, that's an accident. Use the .forms collection and use the NAME, or add an ID. Quote Link to comment Share on other sites More sharing options...
Jim from Oakland Posted January 7, 2007 Author Share Posted January 7, 2007 Thanks again fenway!Need id Indeed! I typed the example hidden input tag in the previous post rather than say copying it from the html source. Here is what I have in the html source. <INPUT type="hidden" name="Item1Price" id="Item1Price" value=60.5><INPUT type="hidden" name="Item1Qty" id="Item1Qty" value=0>I am NOT using a form, just a few input (events) that js responds to. Might that be THE solution? Quote Link to comment Share on other sites More sharing options...
fenway Posted January 7, 2007 Share Posted January 7, 2007 Didn't even realize that INPUTs were valid outside of FORMs. Quote Link to comment Share on other sites More sharing options...
Jim from Oakland Posted January 7, 2007 Author Share Posted January 7, 2007 I found the error. It DID relate to a field with a name attribute but not an id attribute. FYIyou can indeed useinputs that are notin a form. The must have an ide attribute though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.