function successfullySaved()
{
document.getElementById("successfullySaved").value.focus();
}
this function doesnt wrk.. should i try with using scrollBottom? plz suggest me c开发者_JAVA百科ode so that the succesful msg(comes into pic only onclick of Save button in my case) which is getting displayed at the bottom of the page shd retain the scroll bar in same position even after clicking Button.
<td style="padding-left: 345px">
<button class="save" type="button" title="Save" id="Save" name="Save" onclick="javascript:validateSettings(),successfullySaved('successfullySaved');">
<spring:message code="button.save"/></button>
</td>
<table id="successfullySaved">
<c:if test="${saveSuccess eq true}">
<tr> <td>
<spring:message code="security.successful.save"/> </td>
</tr>
</c:if>
</table>
Use this style for table#successfullySaved
position:fixed;bottom:0;
There's no need to set the focus in this case, the message will always appear at the bottom of the viewport.
If you need to support MSIE<7 too, you have to build a workaround by setting the position to a value depending on document.body.scrollTop
, because of MSIE doesnt support position:fixed
in elder versions.
精彩评论