stockton Posted July 6, 2007 Share Posted July 6, 2007 Please tell me why IE6 is having an issue with the following Javascript var MyIssuedValue = document.getElementById("IssuedValue"); var MyOutstandingValue = document.getElementById("OutstandingValue"); IssuedValue = parseInt(MyIssuedValue,10); alert("IssuedValue = "+IssuedValue); IE tells me Problem with this Web page Line: 154 Char: 17 Error: Object does not support this property or method Code: 0 Now there is no line 154 in the html page so I am looking at the attached/called Javascript and line 154 is the alert("IssuedValue = "+IssuedValue); line???????? ??? Quote Link to comment Share on other sites More sharing options...
arianhojat Posted July 6, 2007 Share Posted July 6, 2007 parseInt()'s 1st param is "The string to be parsed" My guess is when you do: var MyIssuedValue = document.getElementById("IssuedValue"); ... var IssuedValue = parseInt(MyIssuedValue,10); MyIssuedValue is the element/OBJECT, when you want the string text in it. document.getElementById("IssuedValue").value might work if its a textfield OR if its just text inside a span or div... document.getElementById("IssuedValue").innerHTML (gets the html inside of element) orrrr... document.getElementById("IssuedValue").firstChild.nodeValue (gets the textNode, then the value of it is the text itself) Ari Quote Link to comment Share on other sites More sharing options...
stockton Posted July 6, 2007 Author Share Posted July 6, 2007 Sorry but I have tried all of your suggestions all without success. Quote Link to comment Share on other sites More sharing options...
arianhojat Posted July 6, 2007 Share Posted July 6, 2007 can you post really simple html example u can post? like just the span or form field that has the number in it and an onclick on a button which runs yer code and alerts you? I can check it out with FireFox/Firebug(FF add-on) and see where problem lies better. Quote Link to comment Share on other sites More sharing options...
stockton Posted July 6, 2007 Author Share Posted July 6, 2007 Thank you for your suggestions and offer of help but the problem was that I was not defining a var. Now why Firefox accepts this and IE does not beats me. I altered IssuedValue = parseInt(MyIssuedValue,10); to var IssuedValue = parseInt(MyIssuedValue,10); & now it works. 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.