Javscript输出问题 [英] Javscript output question

查看:311
本文介绍了Javscript输出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 该代码显示document.write("Welcome to my world !!!
")内部和外部(Enjoy your stay ...)的输出. 那有什么区别

我尝试过的事情:

 <   HTML  > ;  <   >  <  标题 > 我javascript page <  /title  >  <  /head  >  <  正文 > 你好! ! ! <   Br  >  <  脚本 >  "  欢迎来到我的世界!!!< Br>"); <  / 脚本 > 享受您的住宿... <   br  >  <  /body  >  <  /HTML  解决方案

没什么不同,它正在执行您编写的代码. HTML标记中的文本在页面上,脚本中的文本在脚本运行时添加.在您的情况下,脚本将在页面加载时运行.请参见 HTML教程 [ ^ ]了解更多信息.


hi the code shows the output of both within the document.write("Welcome to my world!!!
")and outside (Enjoy your stay...) its prints both
what is the difference of that

What I have tried:

<Html> <head> <title>my javascript page</title> </head>  <body> hello! ! ! <Br> <script> document.write("welcome to my world! ! ! <Br>"); </script> enjoy your stay...<br> </body> </HTML>



output:
Hello!!!
Welcome to my world!!!
Enjoy your stay...

解决方案

No difference, it is doing what you coded. The text in HTML tags is on the page, and the text in the script is added when the script runs. In your case the script will run when the page is loaded. See HTML Tutorial[^] for further information.


这篇关于Javscript输出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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