Home > Web Front-end > HTML Tutorial > Please teach me how to use Baidu free code_html/css_WEB-ITnose

Please teach me how to use Baidu free code_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:20:47
Original
1248 people have browsed it

Baidu free code

<SCRIPT language=javascript>function g(formname)	{var url = "http://www.baidu.com/baidu";if (formname.s[1].checked) {	formname.ct.value = "2097152";}else {	formname.ct.value = "0";}formname.action = url;return true;}</SCRIPT><form name="f1" onsubmit="return g(this)"><table bgcolor="#FFFFFF" style="font-size:9pt;"><tr height="60"><td valign="top"><img src="http://img.baidu.com/img/logo-137px.gif" border="0" alt="baidu"></td><td><input name=word size="30" maxlength="100"><input type="submit" value="百度搜索"><br><input name=tn type=hidden value="bds"><input name=cl type=hidden value="3"><input name=ct type=hidden><input name=si type=hidden value="www.baidu.com"><input name=s type=radio> 互联网<input name=s type=radio checked> www.baidu.com</td></tr></table></form>                                    
Copy after login

This is a free code found on Baidu’s official website. I want to understand the meaning of the code and expand its functions myself.
For example: Implement multiple radio buttons to search on different websites.

I can basically understand the html code, but I don’t know the use of some tn, cl, ct, and js? I hope experienced experts can give me guidance.


Reply to discussion (solution)

Do you want code comments?

function g(formname)    {var url = "http://www.baidu.com/baidu";//设个默认变量urlif (formname.s[1].checked) {//查找formname里面第二个name为s的input是不是被选中    formname.ct.value = "2097152";//如果是formmname里面name为ct的input的值设为2097152}else {    formname.ct.value = "0";//没选中的话设为0}formname.action = url;//formname的action(就是提交地址)指向urlreturn true;}
Copy after login


<form name="f1" onsubmit="return g(this)">
Copy after login

When the above form is submitted, it will call the g method and pass itself in as a parameter (that is, the formname in the g method).
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template