<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function yaz1()
{
document.getElementById("snc").value=(document.getElementById("s1").value*1+document.getElementById("s2").value*1)
}
function yaz2()
{
document.getElementById("snc").value=(document.getElementById("s1").value*1-document.getElementById("s2").value*1)
}
function yaz3()
{
document.getElementById("snc").value=(document.getElementById("s1").value*document.getElementById("s2").value)
}
</script>
</head>
<body>
<table border="0px" bgcolor="#ff0000" cellspacing="1px" width="300px" align="center">
<tr bgcolor="#ffffff">
<td width="125px">1. Sayı</td><td><input type="Text" name="s1" value="10"></td>
</tr>
<tr bgcolor="#ffffff">
<td>2. Sayı</td><td><input type="Text" name="s2" value="20"></td>
</tr>
<tr bgcolor="#ffffff">
<td colspan="2" align="center">
<input type="Button" value="+ (Topla)" onclick="yaz1()">
<input type="Button" value="- (Çıkar)" onclick="yaz2()">
<input type="Button" value="* (Çarp)" onclick="yaz3()">
</td>
</tr>
<tr bgcolor="#ffffff">
<td>Sonuç</td><td><input type="Text" name="snc" value=""></td>
</tr>
</table>
<form name="frm1" action="goster.html" method="post">
</form>
</body>
</html> Javacsript destek
3
●88
- 23-10-2022, 13:43:33Arkadaşlar javascript ile girilen sayıların toplamını, çıkarımını ve çarpımını yaptım. Visual Studio nun live server kısmında kod çalışıyor fakat Chrome gibi tarayıcılarda kod çalışmıyor. Yardımcı olabilir misiniz?
- 23-10-2022, 15:46:04Aşağıdaki kodu alırsanız çalışacaktırTwinays adlı üyeden alıntı: mesajı görüntüle
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script type="text/javascript"> function yaz1() { document.getElementById("snc").value=parseInt(document.getElementById("s1").value)+parseInt(document.getElementById("s2").value) } function yaz2() { document.getElementById("snc").value=parseInt(document.getElementById("s1").value)-parseInt(document.getElementById("s2").value) } function yaz3() { document.getElementById("snc").value=parseInt(document.getElementById("s1").value)*parseInt(document.getElementById("s2").value) } </script> </head> <body> <table border="0px" bgcolor="#ff0000" cellspacing="1px" width="300px" align="center"> <tr bgcolor="#ffffff"> <td width="125px">1. Sayı</td><td><input type="Text" name="s1" id="s1" value="10"></td> </tr> <tr bgcolor="#ffffff"> <td>2. Sayı</td><td><input type="Text" name="s2" id="s2" value="20"></td> </tr> <tr bgcolor="#ffffff"> <td colspan="2" align="center"> <input type="Button" value="+ (Topla)" onclick="yaz1()"> <input type="Button" value="- (Çıkar)" onclick="yaz2()"> <input type="Button" value="* (Çarp)" onclick="yaz3()"> </td> </tr> <tr bgcolor="#ffffff"> <td>Sonuç</td><td><input type="Text" name="snc" value="" id="snc"></td> </tr> </table> <form name="frm1" action="goster.html" method="post"> </form> </body> </html>