Sunday, 15 September 2013

javascript - why does document.all.item does not work on localhost? -



javascript - why does document.all.item does not work on localhost? -

i working on old web app uses document.all.item iterate through dom , causing runtime errors when deploy application in localhost , error dissapears when deploy on server outside machine. below os code throws unknown runtime error. reason or how can go resolving it?

with(document.all) item('fieldname').innerhtml = "blah blah"; // error on line.? }

when tried debug in ie. can access item cannot access innerhtml reason. because of ie or else?

on google chrome, htmlallcollection (the result document.all) has no item property. i'd suggest looping through them for loop:

var items = document.all; var length = items.length; for(var = 0; < length; i++){ //do with: items[i]; }

the behaviour alter might because of inconsistent implementation of item property on htmlallcollections, ie apparently implement it, , server doesn't.

javascript

No comments:

Post a Comment