Je n'ai pas retrouv� mon petit bout de code mais j'ai r�ussi � rassembler
plusieurs morceaux afin de pouvoir afficher les propri�t�s des objets connus
d'un browser.
C'est ainsi que j'ai retrouv� le nom de l'attribut utilis� par
Mozilla/Netscape :
- InnerWidth & InnerHeight
Comme c'est �vident...
Voici donc ce petit bout de code. Attention, ne marche pas avec Konqueror
2.1.1... il faut que je regarde
Daniel
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Various browser properties query code for java</title>
</head>
<body>
<script language=JavaScript>
function getProperties(obj)
{
var properties = "";
properties = '<HTML><BODY><TABLE BORDER="2" WIDTH="90%" COLS="2">';
properties += '<TR ALIGN="left"
BGCOLOR="lightgrey"><TH>Property</TH><TH>Value</TH></TR>';
for (var propName in obj) {
properties
+="<TR><TD>"+propName+"</TD><TD>"+obj[propName]+" </TD></TR>";
}
properties +="</TABLE></BODY></HTML>";
return properties;
}
function getListValue(list)
{
var listValue = "";
if (list.selectedIndex != -1) {
listValue = list.options[list.selectedIndex].value;
}
return (listValue);
}
function whichObject(list) {
var object = "";
var listValue = getListValue(list);
var newWindow =
window.open("","","HEIGHT=400,WIDTH=350,status=1,resizable=1,scrollbars=1")
newWindow.document.write("<HTML><HEAD><TITLE>"+listValue+"</TITLE></HEAD></HTML>")
switch (listValue) {
case "Window":
object = window;
break;
case "Document":
object = window.document;
break;
case "Form":
object = window.document.propForm;
break;
case "Image":
object = window.document.someImage;
break;
case "Link":
object = window.document.links;
break;
case "Navigator":
object = navigator;
break;
}
newWindow.document.write(getProperties(object));
newWindow.document.close();
}
</script>
<form name="propForm">
Please select an object from the list:
<select name = "objectList">
<option selected value="Window">Window
<option value="Date">Date
<option value="Document">Document
<option value="Form">Form
<option value="Image">Image
<option value="Link">Link
<option value="Navigator">Navigator
</select>
<input type=button value="click me"
onClick=whichObject(this.form.objectList)>
</form>
</body>
</html>
--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question. Ouais, pour se d�sabonner aussi.