我试了,在firefox可以.
不过就算可以,我都建议你改成
<input type="text" value="aaa" onfocus="javascript:alert('focus');" id="t1t"/>
<input type="text" id="t2t" value="bbb" onfocus="document.getElementById('t1t').onfocus();" />
不过就算可以,我都建议你改成
<input type="text" value="aaa" onfocus="javascript:alert('focus');" id="t1t"/>
<input type="text" id="t2t" value="bbb" onfocus="document.getElementById('t1t').onfocus();" />
版本是:Firefox/3.0.5
<head>
<script type="text/javascript">
function test (t1t){
var s = document.getElementById(t1t);
s.focus();
return false;
}
</script>
</head>
<body>
<form name="form1" action="" method="post">
<input type="text" value="aaa" id="t1t"/>
<input type="text" id="t2t" value="bbb" onfocus="test('t1t');" /> </body>
</html>
<head>
<script type="text/javascript">
function test (t1t){
var s = document.getElementById(t1t);
s.focus();
return false;
}
</script>
</head>
<body>
<form name="form1" action="" method="post">
<input type="text" value="aaa" id="t1t"/>
<input type="text" id="t2t" value="bbb" onfocus="test('t1t');" /> </body>
</html>