<!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 src="jquery-1.11.1.min.js"></script>
</head>
<body>
<input type="text" id="content">
<INPUT type="button" id="buttoner">
</body>
<script type="text/javascript">
$("#buttoner").click(function () {
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery-1.11.1.min.js"></script>
</head>
<body>
<input type="text" id="content">
<INPUT type="button" id="buttoner">
</body>
<script type="text/javascript">
$("#buttoner").click(function () {
window.location.href="http://www.baidu.com?url="+document.getElementById("contenter").value;
//相当于字符串拼接
</script>
</html>
或者:
<input type="button" id="buttoner" οnclick="window.location.href='http://www.baidu.com?url='+document.getElementById('content').value">
其中需要注意单引号与双引号嵌套的写法