JavaScript 入門

时间:2022-05-27 23:14:52

<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>CSS Resolution Demo</title>
  <link rel="StyleSheet" href="basic.css" type="text/css"/>
  <script type="text/JavaScript">
  var cssName;
  var resolutionInfo;
  if(screen.availWidth<650){
      cssName='lowres.css';
      resolutionInfo='low resolution';
  }else{
      if(screen.availWidth>1000){
          cssName='highres.css';
          resolutionInof='high resolution';
      }else{
          cssName='lowres.css';
          resolutionInfo='medium resolution';
      }
  }
  document.write('<link rel="StyleSheet" href="'+cssName+'"type="text/css"/>');
  </script>
</head>
<body>
  <script type="text/javaScript">
  document.write('<p>Appeelied Stype:'+resolutionInfo+'</p>');
  </script>
</body>
</html>