|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
web课后作业23讲动动手0题,写出来的和老师的代码一样,但老师的那个可以随着数的改变来改变结果,而我的不能,这是为啥?
老师的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>使用output元素显示结果</title>
</head>
<body>
<form oninput="x.value=parseInt(a.value) * parseInt(b.value)" action="welcome.php" method="get">
<fieldset>
<legend>乘法计算器</legend>
<input type="number" id="a" value="10"> ×
<input type="number" id="b" value="10"> =
<output name="x" for="a b">100</output>
</fieldset>
</form>
</body>
</html>
自己的代码:<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>使用output元素显示结果</title>
</head>
<body>
<form oninput="x.value=parseInt(a.value) * parseInput(b.value)" action="welcome.php" method="get">
<fieldset>
<legend>乘法计算器</legend>
<input type="number" id="a" value="10"> ×
<input type="number" id="b" value="10"> =
<output name="x" for="a b">100</output>
</fieldset>
</form>
</body>
</html>
运行结果在附件
你的代码,第七行
- <form oninput="x.value=parseInt(a.value) * parseInput(b.value)" action="welcome.php" method="get">
复制代码
应为
- <form oninput="x.value=parseInt(a.value) * parseInt(b.value)" action="welcome.php" method="get">
复制代码
第二个parseInt打成了parseInput
要细心~
|
-
-
|