faqts : Computers : Programming : Languages : JavaScript : Language Core : Objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

66 of 67 people (99%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How do you display object properties in a pop up window?

Apr 10th, 2001 03:19
Alex Fenton, Dee Syms,


Try this function - 
function popUpProperties(inobj) {
	op = window.open();
	op.document.open('text/plain');
	for (objprop in inobj) {
	op.document.write(objprop + ' => ' + inobj[objprop] + '\n');
	}
	op.document.close();
}
then call it from anywhere, passing it a reference to any Javascript 
object.
e.g.:
// show an input element's properties when it's clicked
<input type="button" name="whatever" onclick="popUpProperties(this)"> 
// show all the properties for the document when a link is clicked
<a href="javascript:popUpProperties(document)">my link</a>
alex fenton 10/04/2021