<head>
<script language=javascript>
function document.onkeydown()
{
if (event.keyCode == 13)
{
//alert("do what you want");
location.href = document.getElementById("ts").href;
}
}
</script>
</head>
<BODY>
<FORM NAME="f">
<input type="text" name="test1"><br>
<input type="text" name="test1"><br>
<a href="http://www.sina.com.cn" id="ts">www.sina.com.cn</a>
</FORM>
</BODY>
<script language=javascript>
function document.onkeydown()
{
if (event.keyCode == 13)
{
//alert("do what you want");
location.href = document.getElementById("ts").href;
}
}
</script>
</head>
<BODY>
<FORM NAME="f">
<input type="text" name="test1"><br>
<input type="text" name="test1"><br>
<a href="http://www.sina.com.cn" id="ts">www.sina.com.cn</a>
</FORM>
</BODY>
解决方案 »
- 有一个jsp页面问题,点击数据项
- 用JavaScript怎么去实现,一个按钮提交多个action?那位朋友帮我弄段代码让我研究下哈!谢谢啦!
- Prototype.js的问题。
- 如何通过JS函数直接提交数据
- javascript获取服务器端的参数值?
- 【如何把一个页里的值改变后。另外一个页也随着改】
- JS中使用微软MonthView问题
- 如何实现开启一个新窗口的问题
- <script>中language属性是用javascript还是jscript好,在VS.Net中语法提示是否不相同?
- 用什么方法,可以将下拉式菜单的边框去掉。
- 一个日文问题,JS能不能把日文排序?
- 在safari浏览器下,用javascript怎么改变标签的长度?
function document.onkeydown()
{
if (event.keyCode == 13)
{
window.location.href(document.getElementById("ts").href);
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<div onmousedown="aa(this);">
<a id="a1" href="http://www.google.cn">google</a>
<input type="text" onkeydown="aa(event);"/></div></body>
</html>
<script type="text/javascript">function aa(evt)
{
evt = (evt) ? evt : ((window.event) ? window.event : "")
if(evt.keyCode == 13)
{
window.location.href=document.getElementById("a1").href;
}
}//window.location.href(document.getElementById("a1").href);
</script>
----
兼容各浏览器的