请在预置代码中编写Javascript代码,使预览页面实现如下效果:
id为demo的段落内容显示7 * 8 = 56
任务与要求
请定义函数myFunction,传入两个参数a、b,返回a和b的积
请调用函数myFunction,引用id为demo的段落内容显示“7 * 8 = 56”
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
</body>
</html>
请在预置代码中编写Javascript代码,使预览页面实现如下效果:
id为demo的段落内容显示7 * 8 = 56
任务与要求
请定义函数myFunction,传入两个参数a、b,返回a和b的积
请调用函数myFunction,引用id为demo的段落内容显示“7 * 8 = 56”
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
</body>
</html>
TA贡献25条经验 获得超3个赞
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> </head> <body> <p id="demo"></p> <script> function myFunction(a, b) { document.getElementById('demo').innerHTML = a + ' * ' + b + ' = ' + a * b; } myFunction(7, 8); </script> </body> </html>
TA贡献1条经验 获得超0个赞
myFunction=(a,b)={ document.getElementById("demo").innerHTML += `${a}*${b}=${a*b}` }
TA贡献69条经验 获得超7个赞
<script> function myFunction(a,b) { console.log("数字是:"+i) document.getElmentById("demo").innerHTML = a "*"+ b + "=" + (a*b) } myFunction(7,8) </script>
举报