惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
F
Full Disclosure
月光博客
月光博客
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
D
DataBreaches.Net
P
Proofpoint News Feed
Cisco Talos Blog
Cisco Talos Blog
NISL@THU
NISL@THU
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
美团技术团队
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Martin Fowler
Martin Fowler
L
Lohrmann on Cybersecurity
Know Your Adversary
Know Your Adversary
Simon Willison's Weblog
Simon Willison's Weblog
S
Securelist
T
Threatpost
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
L
LangChain Blog
Blog — PlanetScale
Blog — PlanetScale
Recorded Future
Recorded Future
C
Cisco Blogs
S
SegmentFault 最新的问题
Cyberwarzone
Cyberwarzone
GbyAI
GbyAI
IT之家
IT之家
S
Schneier on Security
L
LINUX DO - 热门话题
T
Tenable Blog
T
The Exploit Database - CXSecurity.com
MyScale Blog
MyScale Blog
P
Privacy & Cybersecurity Law Blog
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs

博客园 - 杞人

float、double为0判断 Excel操作知识(持续补充) 算法设计方案 C# 动态编译及反射执行 解决由于DTD规范引发Table设置高度无效 - 杞人 - 博客园 VS.NET 代码折叠Region C#访问FTP VS.NET 自动生成版本号问题 - 杞人 - 博客园 UDP通讯 DataSet中表的关系及约束 Web Services 获取当前路径! Windows Services .NET超时解决方案 Facade 外观模式(结构型模式) Decorator 装饰模式(结构型模式) AJAX.NET请求时发生异常处理方案 setTimeout和setInterval的使用说明 Composite 组合模式(结构型模式)
write( ) 和 writeln( )使用说明
杞人 · 2007-06-18 · via 博客园 - 杞人

1、Microsoft JScript 提供了两种方式来在浏览器中直接显示数据。可以使用 write( ) 和 writeln( ),这两个函数是document 对象的方法。

2、writeln( ) 方法与 write( ) 方法几乎一样,差别仅在于是前者将在所提供的任何字符串后添加一个换行符。在 HTML 中,这通常只会在后面产生一个空格;不过如果使用了 <PRE> 和 <XMP> 标识,这个换行符会被解释,且在浏览器中显示。

3、在调用 write( ) 方法时,如果该文档不处于在调用 write( ) 方法时的打开和分析的过程中,该方法将打开并清除该文档,所以它可能是有危险的。

示例:

<html>
 <head>
   <script>
  function DocWrite()
  {
   //<PRE>体现出2的问题
   document.write("<h1>这是使用document.write输出的</h1>");
   document.writeln("<h1>这是使用<PRE>document.writeln输出的</PRE></h1>");
  }
   </script>
 </head>
 <body>
<!--两处调用DocWrite()体现出3的问题-->
  <script>
   DocWrite();
  </script>
  <p>正文内容</p>
  </p><input type="button" name="Submit" value="按钮" onclick="DocWrite()"></p>
 </body>
</html>