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

推荐订阅源

P
Palo Alto Networks Blog
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
GbyAI
GbyAI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
量子位
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
Recent Announcements
Recent Announcements
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
P
Privacy International News Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
NISL@THU
NISL@THU
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
The Register - Security
The Register - Security
M
MIT News - Artificial intelligence
Know Your Adversary
Know Your Adversary
A
Arctic Wolf
F
Full Disclosure
T
Threat Research - Cisco Blogs
P
Privacy & Cybersecurity Law Blog
The Hacker News
The Hacker News
博客园 - 【当耐特】
D
Docker
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Jina AI
Jina AI
Help Net Security
Help Net Security
V
Visual Studio Blog
小众软件
小众软件
B
Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
Forbes - Security
Forbes - Security
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic

博客园 - 一滴水

PHP基础学习(1)-Win2003下安装配置PHP 在右键菜单中添加 Dos cmd窗体,方便使用(意译) HTML转义字符表[zz] - 一滴水 - 博客园 SQLServer2000发生错误1069(由于登陆失败而无法启动服务)的解决方案[zz] - 一滴水 - 博客园 [转载]Javascript的IE和Firefox兼容性汇编 - 一滴水 - 博客园 Hibernate+mysql 乱码问题。。。 关于eclipse中cvs标记的[csdn] [Hibernate]在用hibernate3.0进行查询时,java.lang.NoClassDefFoundError: antlr/ANTLRException【问题记录】 js 文件的编码问题!! 【解决了】 我遇到的一些问题【解决了贴出来当积累了】 获得插入记录标识号的示例 读取Excel表格中的数据[copy] 如何得到服务器端数据库列表 并 备份和恢复数据库 [copy] 将 XML 文件做为数据源绑定到控件 单值数据绑定示例 网上整理 Web JS 通用 呵呵[还会陆续添加] 如何在DataGrid控件中删除最后一页的最后一记录 !!! 鼠标移到DataGrid的那行则更改那行的颜色!!! DataGrid中添加自动编号
关于使用docuemnt.write问题
一滴水 · 2004-11-14 · via 博客园 - 一滴水

先来看看这样一段代码:

<HTML>
<HEAD>
<script language="javascript">
    
<!--Begin Code
    
//******************
    //取得两个text的value 并写在页面上
    //******************
    function GetValue1()
    
{
    document.write(
"Name:"+yidishui.value);
    document.write(
"Age:"+yidishui1.value);
    }

function GetValue2()
{
    
var name=yidishui.value;
    
var age=yidishui1.value;
       document.write(
"Name:"+name);
    document.write(
"Age:"+age);
}

    
//End Code
    // -->
</script>
</HEAD>
<BODY>
Name:
<input type="text" name="yidishui"/><br>
Age:
&nbsp;<input type="text" name="yidishui1"/><br>
<input type="button" onclick="GetValue1()" value="call->GetValue1"/>&nbsp;<input type="button" onclick="GetValue2()" value="call->GetValue2"/>
</BODY>
</HTML> 


看上去两个函数达到的是同一个效果,但是不然。
调用函数GetValue1()运行是达不到效果,欢鳪etValue2()可以实现



===============
调用GetValue1() 是出现错误原因   在使用了第二个 是document.write()出错  ,此时的yidishui1对象已经不存在了,因为使用第一个docuemnt.wrte()时重写了整个页面,所以用的二个时yidishui1对象不存在了!!!
大家可以看看英文对docuemnt.write()的解释:

You should not use the write or writelen methods on the current document after the document has finished loading unless you first call the open method, which clears the current document's window and erases all variables