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

推荐订阅源

I
InfoQ
F
Full Disclosure
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
AWS News Blog
AWS News Blog
The GitHub Blog
The GitHub Blog
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Latest news
Latest news
S
SegmentFault 最新的问题
C
Cisco Blogs
T
Tenable Blog
爱范儿
爱范儿
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Securelist
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
T
Threat Research - Cisco Blogs
IT之家
IT之家
博客园_首页
C
Cyber Attacks, Cyber Crime and Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
K
Kaspersky official blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Privacy International News Feed
腾讯CDC
A
About on SuperTechFans
Y
Y Combinator Blog
月光博客
月光博客
C
Check Point Blog
Last Week in AI
Last Week in AI
Know Your Adversary
Know Your Adversary
Hugging Face - Blog
Hugging Face - Blog
U
Unit 42
WordPress大学
WordPress大学
T
The Exploit Database - CXSecurity.com
H
Hacker News: Front Page
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Vulnerabilities – Threatpost
Cyberwarzone
Cyberwarzone
L
LINUX DO - 热门话题
MongoDB | Blog
MongoDB | Blog
T
Troy Hunt's Blog

博客园 - 碧海无波

Tomcatsession共享方案--memcached-session-manager No control record for Activity type 1000/4220/1442 in version 000 / 2017 activity planning/qty planning 媒体类型和字符集 第四章ContentProvider 5.3刷新视图 5.2视图中的Order by 5.1什么是视图 排它锁、意向排它锁 8.3锁定 8.2事务处理 锁和并发的日记 Asp.net Page指令 跨域访问解决方案 angularJS学习之旅(1) MVC框架 设计模式-桥接模式 GS 未在本地计算机上注册“OraOLEDB.Oracle.1”提供程序解决方案 状态模式
在html中关于如果function的函数名和input的name一样会发生怎样的现象
碧海无波 · 2016-07-26 · via 博客园 - 碧海无波
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="2_PageMethods.aspx.cs" Inherits="MsdnWebCast_WebSerivce1._2_PageMethods" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
    </div>
        <script type="text/javascript">
            function getCurrentTime() {
                PageMethods.GetCurrentDatetime(onsuccessed);
            }
            function onsuccessed(result) {
                alert(result);
            }
        </script>
        <input type="button" name="getCurrentTime" value="get Current Time " onclick="getCurrentTime()" />
    </form>
</body>
</html>

可以看到上面的代码中有一个js的function名字叫getCurrentTime,另外我们还有一个input的那么也叫getCurrentTime,那么运行期会发生什么现象呢

看看IE中的效果

image

看看chrome中的效果

image

原因:系js中一切皆对象,不管什么类型均不能重名,重名的话,即会导致后一个对系那个覆盖前一个对象。

如果把input的name改成其他名字,比如getCurrentTime1,就可以了。