一个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>
{
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>
解决方案 »
- javascript正则匹配字符串可有可无的问题
- 求简化一句脚本...很简单...-___-!!
- 地图图片坐标定位的问题。
- 如何得到一个元素的css值
- 怎样用javacript调用刷新功能?
- 动态加载SCRIPT的问题,牛人请进!!!
- 怎么没有弹出窗口?
- 如何使用JavaScript调用外部命令?解决马上给分!!!
- 关于数字、金额格式怎么用javascript控制的问题??急!!!!小弟先谢了!!!
- JavaScript怎么入门
- 新手求教~JS的基本问题(代码~)动动小手,100分到手·~·
- 如何改写document.execCommand("BackColor",false,"red") 兼容火狐
不行,我只要在text里安回车 症状
先alert出 txtText 的值
之后本页页刷新下, 跟本没location.href还需要其他的什么支持吗