代码如下:
<FORM name=jksearch onsubmit=jksitesearch(this) action=http://www.google.com/search method=get>
<TABLE cellPadding=1>
<TBODY>
<TR>
<TD>Google:<INPUT type=radio CHECKED name=se> Yahoo:<INPUT type=radio name=se> MSN:<INPUT type=radio name=se></TD></TR>
<TR>
<TD><B>搜索 :<INPUT id=hiddenquery type=hidden name=q></B></TD>
<TD><INPUT name=qfront> <INPUT type=submit value=Search></TD></TR></TBODY></TABLE>
<br />
<br /></FORM>
<SCRIPT type=text/javascript>
var domainroot="www.javascriptkit.com"
var searchaction=[
"http://www.google.com/search",
"http://cn.search.yahoo.com/search",
"http://search.msn.com.cn/results.aspx"
]
var queryfieldname=["q","p","q"]
function switchaction(cur, index){
cur.form.action=searchaction[index]
document.getElementById("hiddenquery").name=queryfieldname[index]
}
function jksitesearch(curobj){
for (i=0; i< document.jksearch.se.length; i++){
if (document.jksearch.se[i].checked==true)
switchaction(document.jksearch.se[i], i)
}
document.getElementById("hiddenquery").value=curobj.qfront.value
}
</SCRIPT>