このレベルなJavaScript

インターバルタイマで繰り返しは大事な技だね。インクリメンタルサーチでの文字入力監視とSQLサーバーへのクエリー文字送出で使ってる。
ありゃありゃ、コードが貼り付けられない・・・。

<!DOCTYPE html>
<html lang=”ja”>
<head>
<meta charset=”UTF-8″>
</head>
<body>
<input type=”button” id=”btn” value=”clear”>
<p><button id=”btn2″>参照</button></p>
<p><input type=”text” id=”ent”></input>
<p id=”str”></p>

<script>
document.getElementById(“btn2”).onclick = function() {
(function(){console.log(“do”)})();
document.getElementById(“str”).innerHTML = document.getElementById(“ent”).value;
return false;
};

document.getElementById(“btn”).onclick = function() {
document.getElementById(“ent”).value = “”;
return false;
};

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

————————————————————

<!DOCTYPE html>
<html lang=”ja”>
<head>
<meta charset=”UTF-8″>
</head>
<body>
<input type=”button” id=”btn” value=”clear”>
<p><button id=”btn2″>参照</button></p>
<p><input type=”text” id=”ent”></input>
<p id=”str”></p>

<script>
document.getElementById(“btn2”).onclick = function() {
(function(){console.log(“do”)})();
document.getElementById(“str”).innerHTML = document.getElementById(“ent”).value;
return false;
};

document.getElementById(“btn”).onclick = function() {
document.getElementById(“ent”).value = “”;
return false;
};

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

 

<!DOCTYPE html >
<html lang=”ja”>
<head>
<meta charset =”UTF-8″>
<title>JavaScript テスト</title>
<script>
var cnt =0;
setInterval(“openGoogle()”, 500);
</script>
</head>
<body>

<script>
function openGoogle(){
cnt ++;
console.log( cnt );
document.write( “count=”+cnt+”<br>”);
}
</script>
</body>
</html>

———————————————–

<!DOCTYPE html>
<html>
<head>
<meta charset=“UTF-8” />
<title>jQuery TIPS</title>
</head>
<body>
<button id=“btn”>時刻表示</button>
 
<script src=“http://code.jquery.com/jquery-1.11.1.min.js”></script>
<script>
$(function() {
  // ボタンクリックで時刻を更新
  $(‘#btn’).click(function(e) {
    $(this).text((new Date()).toLocaleString());
  });
});
</script>
</body>
</html>

 

No tags for this post.
タイトルとURLをコピーしました