Trying to display aspect ratios via html - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Trying to display aspect ratios via html

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> 
 </head> /*w ww .  j a  va 2  s.  co m*/
 <body> 
  <script>
function ar() {
  function gcd(x,y){
     return !y?x:gcd(y,x%y);
  }
  var s=screen, w=s.width, h=s.height, r=gcd(w,h);
  return w/r+':'+h/r; 
}
document.body.innerHTML = ar() ;

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

Related Tutorials