Hi there djr33,
here is a javascript example...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>where are you?</title>
<style type="text/css">
body {
margin:0;
background-color:#f0f0f0;
}
#mydiv{
width:160px;
padding:40px;
margin:50px auto;
background-color:#000;
}
#myimg {
display:block;
width:100px;
height:100px;
border:1px solid #fff;
margin:auto;
}
#myp{
width:162px;
height:100px;
margin:50px 0 0 20px;
background-color:#00f;
}
</style>
<script type="text/javascript">
function init() {
obj=document.body.getElementsByTagName('*');
for(c=0;c<obj.length;c++) {
alert(
'\n\n****************************************'+
'\n\nThe element type is '+obj[c].tagName.toLowerCase()+
'.\n\nThe element id is '+obj[c].id+
'.\n\nIt\'s position is..................'+
'\n\ntop="'+obj[c].offsetTop+'px", '+'left="'+obj[c].offsetLeft+'px".'+
'\n\n****************************************'
);
}
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>
</head>
<body>
<div id="mydiv">
<img id="myimg" src="http://www.coothead.co.uk/images/anim2.gif" alt="">
</div>
<p id="myp"></p>
</body>
</html>
coothead
Bookmarks