Skip to main content

Example: Showing Properties

 
<script language="JavaScript" type="text/javascript">
<!--
// Get the name of the object and call the function
display_object_properties(prompt("Enter the name of the object:"))
function display_object_properties(object_string) { 
    // Store the actual object
    var actual_object = eval(object_string)

    // Initialize the message
    var property_message = "Here are the property values for " + 
                            object_string + ":\n\n"

    // Loop through the object's properties
    for (var property_name in actual_object) { 
        property_message += object_string + "." + property_name + " = + 
                            actual_object[property_name] + "\n"
     }

     // Display the message
     alert(property_message)
}

//-->
</script>


 

Next: DHTM features