function googleHint(key){if($('gsuggest'))$('gsuggest').removeNode(true);
IE正常,但火狐不行,提示:$("gsuggest").removeNode is not a function下面是完整代码:
function md()
{
var B=document.getElementById("vl");
var A=document.getElementById("mif");
if(A.src!="r.htm")A.src="r.htm";
if(B.style.display!="block")
{B.style.display="block"}
else
{B.style.display="none"}
return false
}
var isIE=document.all?true:false;function $(i)
{
return document.getElementById(i);
}
function googleHint(key){if($('gsuggest'))$('gsuggest').removeNode(true); ///IE正常,FF出错
if (document.readyState=="complete")
{
var sg=document.body.appendChild(document.createElement('script'));
sg.language='javascript';
sg.id='gsuggest';
sg.charset='gbk';
sg.src='http://ac.xunlei.com:80/complete?ac='+encodeURIComponent(key);
}
}
function myhint(event){
//if(!isIE)  return;
var keyword=$('keyword');
var h=$('suggest');
if(!keyword.value || !keyword.value.length){h.style.display='none';return;}
if(event.keyCode==38 || event.keyCode==40){if(h.style.display=='none') return;if(event.keyCode==38){if(h._i==-1)h._i=h.firstChild.rows.length-1;else{h._i--;}}
else
{h._i++;}for(var i=0;i<h.firstChild.rows.length;i++)h.firstChild.rows[i].style.background="#FFF";
if(h._i >=0 && h._i < h.firstChild.rows.length)with(h.firstChild.rows[h._i]){style.background="#EDFEF1";keyword.value=cells[0].innerText;}else{keyword.value=h._kw;h._i=-1;}}
else
{h._i=-1;h._kw=keyword.value;googleHint(keyword.value);var pos=getPosition(keyword);with(h.style){left=pos.x;top=pos.y+keyword.offsetHeight;width=keyword.offsetWidth-2;}}}window.google={};window.google.ac={};compResp=function(b,c,d){
if(!c || c.length<3) return;
if(b !=$('keyword').value) return;
var ihtml='';
if (document.readyState=="complete")
{
for(var j=1;j<c.length;j++)ihtml+='<tr style="cursor:hand" onmousedown="$(\'keyword\').value=\''+c[j]+'\';"   onmouseover="this.style.background=\'#EFEFEF\';" onmouseout="this.style.background=\'#FFF\';"><td style="color:#000" align="left">'+c[j]+'</td><td style="color:#090" align="right" style="font-size:11.5px;">'+d[j]+'</td></tr>';$('suggest').innerHTML='<table width="100%" border="0" cellpadding="0" cellspacing="0">'+ihtml+'<tr onmouseover="this.style.background=\'#EFEFEF\';" onmouseout="this.style.background=\'#FFF\';"><td colspan=2 align="right" style="border-top:1px solid #EFEFEF;">关键词自动补全结果取自 <a href="http://www.cbf001.com" target="_blank">智能搜索引擎</a></td></tr></table>';
$('suggest').style.display="block";}
else{}};
function getPosition(ele){var overflown=[];
var el=ele, left=0, top=-1;
do{left+=el.offsetLeft || 0;top+=el.offsetTop || 0;el=el.offsetParent;}while (el);return{'x': left, 'y': top};}