Maison  >  Questions et réponses  >  le corps du texte

Pourquoi le calcul n'affiche-t-il pas les résultats ?

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Document sans titre</title>

< ;style>

section{

background-color:#c9e495;

width:280px;

height:330px;

text-align:center;

padding-top:1px;}

textBaroder{.

largeur de bordure: 1px;

style bordure: solide;}

& lt; / style & gt;

& lt; / head & gt;

& lt; body & gt;

& lt; section & gt;

& lt; h1 & gt; ;

<img src="image/logo.jpg" width="260" height="31">Bienvenue sur Taobao !

</h1>

<form action="" method="post" name="myform" id="myform">

<h3>

<img src="file:/ //F|/17webpage/computer/image/shopping cart.jpg" width="54" height="54">Calculatrice d'achat simple

</h3>

premier numéro<input name="txtNum1" type="text" class="textBaroder" id="txtNum1" size="25">

Deuxième numéro<input name="txtNum2" type="text" class= "textBaroder" id="txtNum2" size="25">

<input name="addButton2" type="button" id="addButton2" value=" + " onChange="compute('+' )">

< nom d'entrée="subButton2" type="bouton" id="subButton2" value=" - " onChange="compute('-')">

<nom d'entrée="mulButton2 " type="bouton" id= "mulButton2" value=" × " onChange="compute('*')">

<input name="divButton2" type="button" id="divButton2" value= " ÷ " onChange="compute( '/')">

Résultat du calcul<INPUT name="textResult" type="text" class="textBaroder" id="textResult" size="25"> ;

</form>

</section>

<script>

function calculate(op)

{

var num1,num2;

num1 = o arseFloat(document .myform.txtNum1.value);

num2 = oarseFloat(document.myform.txtNum2.value);

if (op=="+")

document.myform.txtResult.value = num1+num2;

if (op=="-" )

document.myform.txtResult.value = num1-num2;

if (op=="*")

document.myform.txtResult.value = num1*num2;

if (op=="/" && num2!=0)

document.myform.txtResult.value = num1/num2;

}

</script>

</body>

</html>

BBBB1045 Il y a quelques jours1096

répondre à tous(3)je répondrai

  • 雪了无痕

    雪了无痕2021-11-10 11:05:16

    http://b68z56d.cn/Liangqiu Jingzhi Information Network est publié

    répondre
    0
  • 小晴子

    小晴子2021-11-10 10:04:06

    http://sn4r209.cn/Chunyu Jifeng Renouvellement du réseau d'information

    répondre
    0
  • autoload

    autoload2021-10-29 10:48:45

    1.oarseFloat ? parseFloat ? C'est vraiment déroutant. 2. Il y a un autre problème, txtResult est faux. 3. OnChange peut-il être utilisé ? Remplacer par onclick

    répondre
    2
  • Annulerrépondre