<html>
<head>
<base target="_blank"/>
<meta http-equiv="content-type" content="text/html; charset=gb2312"/>
<meta http-equiv="content-script-type" content="text/javascript"/>
<meta name="Author" content="Langtse.51.net"/>
<title>选择搜索</title>
</head>
<body><form action="" method="get" onSubmit="return doSubmit(this);"> 
关键字:<input id="kbd" name="key" type="text" value="csdn"/>
<input type="submit" value="搜索">
<br>
<input type="radio" name="by" value="wd" onclick="doRadio(this);"/>网页搜索
<input type="radio" name="by" value="kw" onclick="doRadio(this);"/>贴吧搜索
</form>
<script type="text/javascript">
function doRadio(oRadio)
{
this.obj=document.getElementById('kbd');
this.obj.name=oRadio.value;
}
function doSubmit(frm)
{
  var kbd=document.getElementById('kbd').name;
frm.action=kbd=="kw"?"http://tieba.baidu.com/f":"http://www.baidu.com/s";
return true;
}
</script></body>
</html>
提交结果:
1、直接提交:http://www.baidu.com/s?key=regex
2、网页搜索:http://www.baidu.com/s?wd=regex&by=wd
3、贴吧搜索:http://tieba.baidu.com/f?kw=regex&by=kw