Forumet - två textfält

två textfält

166 0 21
<html><head>
<script type="text/javascript">
var sum=0;
var ant=0;
function f1()
{
ant+=1;
sum+=parseInt(document.form1.tal1.value);
document.form1.tal2.value=sum/ant;
document.form1.tal1.value="";
}
function f2()
{ if((document.form1.tal1.value=="") &&
(parseInt(document.form1.tal2.value)>10))
return true;
alert("Felaktiga värden");
return false;
}
</script>
<title>Uppgift6</title>
</head><body>
<form action="taemot.php" method="get" name="form1"
onSubmit="return f2()">
<input name="tal1" type="text">
<input name="" type="button" onClick="f1()">
<input name="tal2" type="text">
<input name="" type="submit" >
</form>
</body>
</html>
ett textfält och en skicka-knapp

<html>
<title></title>
</head>
<body>
<?php
echo "session_start()";
session_start();
if($_GET["tal1"]!="")
{
$_SESSION["sum"]+= $_GET["tal1"];
$_SESSION["ant"]+= 1;
echo $_SESSION["sum"].":".$_SESSION["ant"];
}
else
{
echo "session_destroy()";
session_destroy();
}
?>
<form action="p2.php" method="get">
<input name="tal1" type="text">
<input name="submit" type="submit" value="Skicka">
</form>
</body>
</html>
Schism:

session_destroy();
}
?>
<form action="p2.php" method="get">
<input name="tal1" type="text">
<input name="submit" type="submit" value="Skicka">
</form>
</body>
</html>


...[blush]

storlek+=1;
nod1=document.childNodes[0].childNodes[1].childNodes[1].childNodes[0].childNodes[1].​childNodes[0];

Spana också in: