JScript程序问题:看不懂这个程序

来源:百度知道 编辑:UC知道 时间:2024/05/24 09:17:22
无意间看到一个很复杂的Jscript程序,想学习学习,但是看不明白。请高手帮忙指点指点。
htm里有:
<body>
<form name=f action=s>
<input type=text name=wd id=kw size=42 maxlength=100>
<input type=submit value=搜索 id=sb><span id=hp>
</form>
</body>
<script>
var w=document.f.wd;
function s(o){
if(w.value.length>0)
{var h=o.href;
var q=encodeURIComponent(w.value);
if(h.indexOf("q=")!=-1){o.href=h.replace(new RegExp("q=[^&$]*"),"q="+q)}else{o.href+="?q="+q}}
};
(function(){if(new RegExp("q=([^&]+)").test(location.search)){w.value=decodeURIComponent(RegExp.$1)}})();
if(navigator.cookieEnabled && !/sug?=0/.test(document.cookie)){
document.write('<script src=jscode.js?v=1.1.0.1><\/script>')};
window.onunload=function(){};
</script>
<script>

(function(){
// 浏览器为IE?
var H=navigator.userAgent.indexOf("MSIE")!=-1&&!window.opera;
// IE8 使用了兼容视图?
var E=(document.compatMode=="BackCompat");
// 用ID找元素
function Q(C){return document.getElementById(C)}
// 创建元素
function B(C){return document.createElement(C)}
// 添加事件侦听器
function I(G,R,C){
if(H){G.attachEvent("on"+R,(function(S){return function(){C.call(S)}})(G))}
else{G.addEventListener(R,C,false)}}
function D(C){
if(H){C.returnValue=false}
else{C.preventDefault()}}
// 插入css规则
function J(C,R){
var S=document.styleSheets;
if(!S||S.length<=0)
{var G=document.createElement("STYLE");
G.type="text/css";
var T=document.getElementsByTagName("HEAD")[0];
T.appendChild(G)
}
S=document.styleSheets;
S=S[S.length-1];
if(H){S.addRule(C,R)}
else{S.insertRule(C+" { "+R+" }",S.css