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

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers 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,就可以了。