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

推荐订阅源

The Cloudflare Blog
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
博客园 - 司徒正美
V
Visual Studio Blog
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
S
SegmentFault 最新的问题
T
The Blog of Author Tim Ferriss
D
Docker
Vercel News
Vercel News
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
爱范儿
爱范儿
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏

Python | 酷 壳 - CoolShell

Python修饰器的函数式编程 | 酷 壳 - CoolShell 函数式编程 | 酷 壳 - CoolShell 二叉树迭代器算法 | 酷 壳 - CoolShell 一些有意思的算法代码 | 酷 壳 - CoolShell Python 和 PyGame 的一些示例 | 酷 壳 - CoolShell 五大基于JVM的脚本语言 | 酷 壳 - CoolShell Python处理encoding的小技巧 | 酷 壳 - CoolShell Python程序员的进化 | 酷 壳 - CoolShell 如何使用Python操作摄像头 | 酷 壳 - CoolShell 非常简单的Python HTTP服务 | 酷 壳 - CoolShell Erlang和Python互通 | 酷 壳 - CoolShell Python也Spring了 | 酷 壳 - CoolShell Python 自然语言处理 | 酷 壳 - CoolShell 用TCC可以干些什么? | 酷 壳 - CoolShell
在Javascript里写Python | 酷 壳 - CoolShell
陈皓 · 2010-07-21 · via Python | 酷 壳 - CoolShell

以前,本站介绍过去一种写HTML和CSS的新方法,以一种杂交式的代码,昨天给大家介绍了.NET代码和Python及Ruby代码的互相转换工具,但是这个世界可能比我们想像的还疯狂。IronPython 是一个在.NET平台上运行Python的东西,就像那些在JVM上运行其它语言的东东一样。当然,IronPython最邪恶的事情并不是在.NET上运行Python,而是在Javascript里写Python的语法。这个畸形混血儿的网址在这里(请注意翻墙)。

使用这个玩意很简单,下面,让我们看看这个混血儿长啥样?

首先,你需要链接一个js文件:

<script src="http://gestalt.ironpython.net/dlr-latest.js" type="text/javascript"></script>

然后,让我们看看如何写一个按钮事件:

<input id="button" type="button" value="Say, Hello!" />
<script type="text/python">
  def button_onclick(s, e):
      window.Alert("Hello from Python!")
  document.button.events.onclick += button_onclick
</script>

你对此事怎么看?欢迎留下你的看法。

Loading...