初学....望大虾帮帮忙如何实现这个功能?第一个单选框 选中 百度搜索
第二个单选框 选中 谷歌搜索?
<!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" />
<title>无标题文档</title>
</head><body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form id="form1" name="form1" method="post" action="">
<label>
<input type="text" name="textfield" id="textfield" />
</label>
<label>
<input type="submit" name="button" id="button" value="提交" />
</label>
</form></td>
</tr>
<tr>
<td><form id="form2" name="form2" method="post" action="">
<label>
<input type="radio" name="radio" id="radio" value="radio" />
</label>
<label>
<input type="radio" name="radio" id="radio2" value="radio" />
</label>
</form></td>
</tr>
</table>
</body>
</html>
第二个单选框 选中 谷歌搜索?
<!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" />
<title>无标题文档</title>
</head><body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form id="form1" name="form1" method="post" action="">
<label>
<input type="text" name="textfield" id="textfield" />
</label>
<label>
<input type="submit" name="button" id="button" value="提交" />
</label>
</form></td>
</tr>
<tr>
<td><form id="form2" name="form2" method="post" action="">
<label>
<input type="radio" name="radio" id="radio" value="radio" />
</label>
<label>
<input type="radio" name="radio" id="radio2" value="radio" />
</label>
</form></td>
</tr>
</table>
</body>
</html>
google 地址有点问题.<!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=gbk" />
<title>无标题文档</title>
<script>
function search()
{
var obj = document.getElementsByName("radio");
val = "1";
for(i=0;i<obj .length;i++)
{
if(obj[i].checked){
val = obj[i].value;
break;
}
} document.form1.action= (val=="1"?"http://www.baidu.com/s?wd=":"http://www.google.com.hk/search?hl=zh-CN&source=hp&q=" )+document.getElementById("textfield").value;
document.form1.submit();
}
</script></head><body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form id="form1" name="form1" method="post" action="">
<label>
<input type="text" name="textfield" id="textfield" />
</label>
<label>
<input type="submit" name="button" onclick="search();" id="button" value="提交" />
</label>
</form></td>
</tr>
<tr>
<td><form id="form2" name="form2" method="post" action="">
<label>
<input type="radio" name="radio" id="radio" value="1" />百度
</label>
<label>
<input type="radio" name="radio" id="radio2" value="2" />google
</label>
</form></td>
</tr>
</table>
</body>
</html>
http://www.google.com.hk/search?hl=zh-CN&source=hp&q=中国&
请问怎么改成POST提交呢?