<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<style>
</style>
<body>
<p><input type="text" id="veri1" name="veri1"></p>
<p><input type="text" id="veri2" name="veri2"></p>
<p id="demo"></p>
<script type="text/javascript">
var result=document.getElementById("demo");
times=setInterval(toplam, 1000);
function toplam(){
var data1, data2,sonuc;
data1=Number(document.getElementById("veri1").value);
data2=Number(document.getElementById("veri2").value);
sonuc=data1+data2;
result.innerHTML=sonuc;
}
</script>
</body>
</html>
Bu Blogda Ara
24 Aralık 2018 Pazartesi
19 Aralık 2018 Çarşamba
Javascript ile Tek Sayıları Ekrana Yazdırma
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<style>
</style>
<body>
<input type="text" value="0" id="deger">
<button type="button" onclick="eylem()">Click Me</button>
<p id="result"></p>
<script type="text/javascript">
function eylem(){
var x= Number(document.getElementById("deger").value);
var text=" ";
var i;
for(i=0; i<=x; i++){
if(i%2==0){
continue;
}
text +=i+"<br>"
}
document.getElementById("result").innerHTML=text;
}
</script>
</body>
</html>
<html lang="tr">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<style>
</style>
<body>
<input type="text" value="0" id="deger">
<button type="button" onclick="eylem()">Click Me</button>
<p id="result"></p>
<script type="text/javascript">
function eylem(){
var x= Number(document.getElementById("deger").value);
var text=" ";
var i;
for(i=0; i<=x; i++){
if(i%2==0){
continue;
}
text +=i+"<br>"
}
document.getElementById("result").innerHTML=text;
}
</script>
</body>
</html>
Javascript Yön Tuşları Kullanma
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body id="bdy">
<style>
#Container{
box-sizing: border-box;
width: 600px;
height: 600px;
border: 3px solid gray;
position: relative;
}
#Container #ContainerInside{
box-sizing: border-box;
width: 48px;
height: 48px;
background-color:yellow;
position: absolute;
}
</style>
Sonuc:
<input type="button" value="0" id="sonuc">
<input type="button" value="0" id="sonuc1">
<div id="Container">
<div id="ContainerInside"></div>
</div>
<script>
var pos1=0, pos2=0;
document.onkeydown=function keyKontrol(e){
var keyKod=e.which;
var box= document.getElementById("ContainerInside");
var tuval= document.getElementById("Container");
var sonuc= document.getElementById("sonuc");
var sonuc1= document.getElementById("sonuc1");
if(keyKod == 37){
if(pos1>0)
sonuc.value=Number(sonuc.value)-50;
pos1= sonuc.value;
box.style.left= pos1 + "px";
console.log("37: "+pos1);
}
if(keyKod == 38){
if(pos2>0)
sonuc1.value=Number(sonuc1.value)-50;
pos2= sonuc1.value;
box.style.top= pos2 + "px";
console.log("38: "+pos2);
}
if(keyKod == 39){
if(pos1<550)
sonuc.value=Number(sonuc.value)+50;
pos1= sonuc.value;
box.style.left= pos1 + "px";
console.log("39: "+pos1);
}
if(keyKod == 40){
if(pos2<550)
sonuc1.value=Number(sonuc1.value)+50;
pos2= sonuc1.value;
box.style.top= pos2 + "px";
console.log("40: "+pos2);
}
console.log("sonuc1: "+sonuc.value);
console.log("sonuc2: "+sonuc1.value);
}
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
</head>
<body id="bdy">
<style>
#Container{
box-sizing: border-box;
width: 600px;
height: 600px;
border: 3px solid gray;
position: relative;
}
#Container #ContainerInside{
box-sizing: border-box;
width: 48px;
height: 48px;
background-color:yellow;
position: absolute;
}
</style>
Sonuc:
<input type="button" value="0" id="sonuc">
<input type="button" value="0" id="sonuc1">
<div id="Container">
<div id="ContainerInside"></div>
</div>
<script>
var pos1=0, pos2=0;
document.onkeydown=function keyKontrol(e){
var keyKod=e.which;
var box= document.getElementById("ContainerInside");
var tuval= document.getElementById("Container");
var sonuc= document.getElementById("sonuc");
var sonuc1= document.getElementById("sonuc1");
if(keyKod == 37){
if(pos1>0)
sonuc.value=Number(sonuc.value)-50;
pos1= sonuc.value;
box.style.left= pos1 + "px";
console.log("37: "+pos1);
}
if(keyKod == 38){
if(pos2>0)
sonuc1.value=Number(sonuc1.value)-50;
pos2= sonuc1.value;
box.style.top= pos2 + "px";
console.log("38: "+pos2);
}
if(keyKod == 39){
if(pos1<550)
sonuc.value=Number(sonuc.value)+50;
pos1= sonuc.value;
box.style.left= pos1 + "px";
console.log("39: "+pos1);
}
if(keyKod == 40){
if(pos2<550)
sonuc1.value=Number(sonuc1.value)+50;
pos2= sonuc1.value;
box.style.top= pos2 + "px";
console.log("40: "+pos2);
}
console.log("sonuc1: "+sonuc.value);
console.log("sonuc2: "+sonuc1.value);
}
</script>
</body>
</html>
Kaydol:
Kayıtlar (Atom)
Python Pyqt5 ile Hesap Makinası
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from mainUI import * from PyQt5.QtCore import * import sys # ----------------------U...