<head> of your html document
<script type="text/javascript">
var scrAr1 = screen.width / screen.height;
</script>
<body>
<script type="text/javascript">
<!--
document.write(""+scrAr1+":1");
//-->
</script>
Screen Aspect Ratio - Displays:
Save the following script as aspectratio.js
<!--
var scrAr2 = screen.width / screen.height;
document.write(""+scrAr2+":1");
// or
// document.write(""+screen.width+"/"+screen.height+":1");
// without variable
//-->
<body> of your html document
<script src="/js/aspectratio.js" type="text/javascript"></script>
Screen Aspect Ratio - Displays:
<body> of your html document
<script type="text/javascript">
<!--
var scrAr3 = screen.width / screen.height;
document.write("Aspect Ratio is "+scrAr3+":1");
// or
// document.write("Aspect Ratio is "+screen.width+"/"+screen.height+":1");
// without variable
//-->
</script>
Screen Aspect Ratio - Displays: