<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function welcome(name){
alert(name+",欢迎您进入函数世界");
}
</script>
<title>11.2.2</title>
</head><body>
<form>
姓名:<input type="text" name="title" id="title">
<input type="button" value="Click me!" onclick="welcome(document.getElementById('title').value)" />
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function welcome(name){
alert(name+",欢迎您进入函数世界");
}
</script>
<title>11.2.2</title>
</head><body>
<form>
姓名:<input type="text" name="title" id="title">
<input type="button" value="Click me!" onclick="welcome(document.getElementById('title').value)" />
</form>
</body>
</html>
alert(name+",欢迎您进入函数世界");
}
看看2个大括号是不是全角的,改成半角的
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function welcome(name){
alert(name+",欢迎您进入函数世界");
}
</script>
<title>11.2.2</title>
</head><body>
<form>
姓名:<input type="text" name="title" id="title">
<input type="button" value="Click me!" onclick="welcome(document.getElementById('title').value)" />
</form>
</body>
</html>
这个问题到我这里一眼就看出来了,大括号的编码是有问题的,我是日文的系统,想想就知道为什么了吧。中文的编码到我这里都是乱码如果你的大括号是适用于其他字符一样的编码就不会是乱码,所以重新改改吧~