鱼C论坛

 找回密码
 立即注册
查看: 2562|回复: 3

[已解决]求助大佬

[复制链接]
发表于 2022-4-14 10:07:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

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>

运行结果在附件
最佳答案
2022-4-14 10:23:51
你的代码,第七行
  1. <form oninput="x.value=parseInt(a.value) * parseInput(b.value)" action="welcome.php" method="get">
复制代码

应为
  1. <form oninput="x.value=parseInt(a.value) * parseInt(b.value)" action="welcome.php" method="get">
复制代码


第二个parseInt打成了parseInput

要细心~
老师.png
自己.png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-4-14 10:23:51 | 显示全部楼层    本楼为最佳答案   
你的代码,第七行
  1. <form oninput="x.value=parseInt(a.value) * parseInput(b.value)" action="welcome.php" method="get">
复制代码

应为
  1. <form oninput="x.value=parseInt(a.value) * parseInt(b.value)" action="welcome.php" method="get">
复制代码


第二个parseInt打成了parseInput

要细心~
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-4-14 10:24:19 | 显示全部楼层
你的 parseInt 写成了parseInput

<!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>
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-4-15 09:05:49 | 显示全部楼层
青出于蓝 发表于 2022-4-14 10:23
你的代码,第七行

应为

感谢!!!以后一定多多注意
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-28 08:45

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表