---
title: "全角空格惹的祸"
author: "opensuse"
date: "2009-03-19T17:17:04Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2009-03-19T17:17:04Z"
id: 351658
url: "https://opensuse.iteye.com/blog/351658"
---

今天遇到这么一个问题.

 

一个SO EASY的页面.只有一个按钮,点击执行一个function

 

可是却发现不执行,如下.

 

```
<html>
 <input type="button" value="heihei"　onclick="go();" />
</html>
 <script type="text/javascript">
  function go()
  {
   alert('xxx');
  }
 </script>
```

 

 

不要以为是&lt;script&gt;放在外面的问题哦.

 

真正的原因是onclick前面有一个"全角空格","　"

 

把它去掉就可以了.

 

如:

 

 

```
<html>
	<input type="button" value="heihei" onclick="go();" />
</html>
	<script type="text/javascript">
		function go()
		{
			alert('xxx');
		}
	</script>
```

 

 

问题解决...