Advertisement
Guest User

index.html

a guest
Jul 4th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.04 KB | None | 0 0
  1. <html>
  2.  
  3.     <head>
  4.         <link rel="stylesheet" type="text/css" href="screen.css" media="screen" />
  5.         <link rel="stylesheet" type="text/css" href="handheld.css" media="only screen and (max-width: 480px), only screen and (max-device-width: 480px)" />
  6.         <script>
  7.             function checkBrowserType() {
  8.                 var col = window.getComputedStyle(document.getElementById("browsertype")).color;
  9.                 if (col == "rgb(1, 0, 0)") {
  10.                     console.log("screen.css wurde geladen");
  11.                     document.getElementById("output").innerHTML = "Du benutzt kein Handy";
  12.                     document.getElementById("outimg").src = "bigimg.png";
  13.                 } else if (col == "rgb(2, 0, 0)") {
  14.                     console.log("handheld.css wurde geladen");
  15.                     document.getElementById("output").innerHTML = "Du benutzt ein Handy";
  16.                     document.getElementById("outimg").src = "mobileimg.png";
  17.                 } else {
  18.                     console.log("errrroooorrr!!!");
  19.                 }
  20.             }
  21.         </script>
  22.     </head>
  23.    
  24.     <body onload="checkBrowserType();">
  25.         <div id="browsertype"></div>
  26.         <div id="output"></div>
  27.         <img id="outimg" src="">
  28.     </body>
  29.  
  30.  
  31.  
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement