Click to See Complete Forum and Search --> : need alert for navigator properties


1christine
12-22-2003, 01:37 PM
Now, I'm trying to create an alert box that will show all the navigator properties at the same time with a break line between each property.
This is the code I have so far but can't get it into 1 alert box with the break line.
I can get it to break, but it does this for each property.

I think I could do with an array code but I don't quite understand 'array'

<HTML>
<HEAD>
<TITLE>Navigator Properties</TITLE>
</HEAD>
<BODY>
<PRE>
<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
for (prop in navigator) {
var navigProp = (prop + ": " + navigator[prop]);
alert(navigProp);
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->

</SCRIPT>
</PRE>
</BODY>
</HTML>

AdamBrill
12-22-2003, 01:48 PM
<html>
<head>
<title>Navigator Properties</title>
</head>
<body>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
var navigProp="";
for (prop in navigator) {
navigProp += (prop + ": " + navigator[prop]+"\n");
}
alert(navigProp);
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->

</script>
</body>
</html>

1christine
12-22-2003, 02:27 PM
Thanks Adam.
It works.

AdamBrill
12-22-2003, 03:10 PM
No problem. :)