如何知道现在的TAG是多少?

来源:百度知道 编辑:UC知道 时间:2024/05/31 07:13:03
像一些radiobutton,textbox之类的东西,都有个tag,tagstop来方便按tab时进行跳转的。

那么,如何在程序里得知现在tag到哪了?

看了半天没看明白你要问啥!
呵呵,tab实际上是转移了焦点,所以你的问题向下面这么问才能让人明白:“javascript我如何才能获得当前焦点控件”

答案如下:
<html>
<script Language="javascript">
var objFocused = null;

function getFocusedTextbox()
{
if(objFocused !=null)
alert(objFocused.value);
else
alert("no textbox focused!");

}

</script>
<body>
<input type="button" value="test" onClick="getFocusedTextbox()">
<input type="text" onFocus="objFocused=this;" value="aa">
<input type="text" onFocus="objFocused=this;" value="bb">
<input type="text" onFocus="objFocused=this;" value="cc">
<input type="te