views:

22

answers:

1
function successfullySaved()
{
document.getElementById("successfullySaved").value.focus();
} 

this function doesnt wrk.. should i try with using scrollBottom? plz suggest me code 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>

A: 

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.

Dr.Molle
hi msg ill appear at the bottom of page but on save, page gets refreshed by saving the data to DB and goes to the top of page right that timme how to handle the issue?
kumudam
Save the data using ajax, then the page does'nt need to refresh.
Dr.Molle