MyWorld

<!DOCTYPE html><html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width" />
  <title>Hello, world!</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body>
  <h1>Hello, world!</h1>

  <div id="test"></div>

  <!--
  <img src="img/icon.png">
  -->
  

  <script src="script.js"></script>

  <button onclick="sample()">サンプル1実行</button>
  <button onclick="sample2('おれ',22)">サンプル2実行</button>
  <button onclick="count()">カウント</button>
  <button onclick="speedtest()">Test</button>
  <div id="test2"></div>

  <div id="console_log"></div>

</body>
</html>
#test {
  color: gray;
}

#test2 {
  color: Black;
}
addEventListener('load', function(e) {
  document.querySelector('#test').innerHTML = 'Hello, world!';
});

addEventListener('load', function(e) {
  document.querySelector('#test2').innerHTML = 'ConsoleLog';
});

console.log = function (log) {
document.getElementById('console_log').innerHTML += ">" + log + "<br>";
}


function sample() {
    var text = 'Hello World';    
    console.log(text);
}


function sample2(name, age) {
   console.log(name + 'さんの年齢は' + age + 'です!'); 
}


var ct = 0
function count(){
   ct = ct + 1
    console.log(ct)
}


function speedtest(){
   const startTime =  // 開始時間
    console.log('計測中...'); // 計測する処理
   const endTime = Date.now(); // 終了時間;
   const speed = endTime - startTime;
    console.log('計測結果>>>' + '0.' + speed + 's');
  }











Full page Open in App

4 months ago

teat

Pages


comments powered by Disqus