<body onload="javascript:showLoginMeg('usrId','${loginForm.loginMsg}');"> //在body中定义事件
function showLoginMeg(logobj,loginMsg){
if ("" != loginMsg){
//logobj.focus();
alert(loginMsg);
document.getElementById(logobj).focus(); //此处的logobj是一个字符串 得把他转换成对象进行焦点的定位
}
}
<pre></pre>
<pre></pre>
<div class="translator-theme-default" id="translator-floating-panel" style="bottom:auto; left:0px; right:auto; top:89px">
<div title="点击翻译" id="translator-floating-panel-button"></div>
</div>
<pre></pre>
<div class="translator-theme-default" id="translator-floating-panel" style="bottom:auto; left:545px; right:auto; top:20px">
<div title="点击翻译" id="translator-floating-panel-button"></div>
</div>
<div style="padding-top:20px">
<p style="font-size:12px;">版权声明:本文为博主原创文章,未经博主允许不得转载。</p>
</div>
温馨提示:答案为网友推荐,仅供参考