一个text  一个IMG执行同一个方法 点img执行正常 但是在text里敲回车就不能跳转,我加了个alert测试,敲回车也能正常弹出txtText的值,也就是说在location.href之前的语句都执行了,但是没跳转,请教是为什么function Search() 

if(document.all.txtText.value!="")
{
alert(document.all.txtText.value);//测试是否进来了
 location.href = "SearchProduct.aspx?name="+document.all.txtText.value;
}
} <td width="549"><label> <input name="textfield" type="text" class="inputt" size="82" id="txtText" onkeydown="if(event.keyCode==13){Search()}"> </label>
</td>
<td width="66"><IMG alt="" src="ima/button.jpg" style="CURSOR:hand" onclick="Search()"></td>