[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Accessing document property values

Posted on 1999-12-06
5
Medium Priority
?
200 Views
Last Modified: 2008-02-01
I'm merely attempting to display the document property values in my IE5 browser. Code:
<script language = "Javascript">
document.Name="MyDoc"
function displayObject(inputObject, inputObjectName) {
  var result = ""
    for (var EachProperty in inputObject) {
    result += inputObjectName + "." + EachProperty +
      inputObject[EachProperty] + "<BR>"
    }
return result
}
document.writeln(displayObject(document, "MyDoc"))
</script>

The inputObject[EachProperty] is erroring out. Removing it displays a list of all document properties without a value.
0
Comment
Question by:thomfl
  • 2
  • 2
5 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 2258824
Try this:

.... + inputObject[EachProperty].value + "<BR>"

or

.... + eval("inputObject."+EachProperty+".value") + "<BR>"
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2258827
hmm, the ".value" stuff is probably not right.  Maybe just this:
eval("inputObject."+EachProperty)
0
 

Author Comment

by:thomfl
ID: 2258854
thanks... I tried those combinations (and others) ... no luck
0
 

Accepted Solution

by:
gpeeraer earned 200 total points
ID: 2258930
I had the same problem.

It seems that in IE5 you cannot access the document object as an array of properties. So you cannot access the properties within a for or for each construction. In other browsers this works fine.



0
 

Author Comment

by:thomfl
ID: 2260223
gpeeraer - thanks.. saved me some time... same thing I had found, others verified.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question