函数没有多次调用 [英] function is not calling multiple times

查看:86
本文介绍了函数没有多次调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <script>
            function apple(one, two) {
                document.write(one + " is better than " + two + "<br /");
            }
			apple("this","that");
			apple("bannana","apple");
			apple("hal","alks");
        </script>
    </body>
</html>





我正在尝试多次调用,但功能只调用一次

输出应该是 - 这比那更好

banana比apple更好/>
hal比alks

更好,但我的输出是 - 这比



I am trying to call it multiple times but the function is calling one time only
the output should be - "this is better than that
banana is better than apple
hal is better than alks"
but my output is - "this is better than that"

推荐答案

更好,它真的被称为3次。该解决方案仅需3秒钟:您的错误是:缺少>在< br />中。原因是:它产生了无效的HTML。



这就是全部。添加缺少的字符,您的三个调用将显示正确的文字。



-SA
No, it is really called 3 times. The solution took just 3 seconds: your bug is: missing ">" in "<br />". The reason: it produced invalid HTML.

That's all. Add the missing character, and your three calls will show correct text.

—SA


这篇关于函数没有多次调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆